Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add fetch priority #7037

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions website/docs/en/api/modules/module-methods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ import(
/* webpackPreload: true */
/* webpackMode: "lazy" */
/* webpackIgnore: true */
/* webpackFetchPriority: "high" */
'module'
);
```
Expand Down Expand Up @@ -162,6 +163,14 @@ Tells the browser that the resource might be needed during the current navigatio

A name for the new chunk.

##### webpackFetchPriority

<ApiMeta addedVersion="1.0.0" />

- **Type:**: `"low" | "high" | "auto"`

Set [`fetchPriority`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchPriority) for specific dynamic imports. It's also possible to set a global default value for all dynamic imports by using the `module.parser.javascript.dynamicImportFetchPriority` option.
LingyuCoder marked this conversation as resolved.
Show resolved Hide resolved
LingyuCoder marked this conversation as resolved.
Show resolved Hide resolved

## CommonJS

Rspack is also support `CommonJS` syntax natively, you can use `require` and `module.exports` methods.
Expand Down
9 changes: 9 additions & 0 deletions website/docs/zh/api/modules/module-methods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ import(
/* webpackPreload: true */
/* webpackMode: "lazy" */
/* webpackIgnore: true */
/* webpackFetchPriority: "high" */
'module'
);
```
Expand Down Expand Up @@ -160,6 +161,14 @@ import(

指定新 chunk 的名称。

##### webpackFetchPriority

<ApiMeta addedVersion="1.0.0" />

- **类型:**: `"low" | "high" | "auto"`

为指定的动态导入设置 [`fetchPriority`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchPriority)。也可以通过使用 `module.parser.javascript.dynamicImportFetchPriority` 选项为所有动态导入设置全局默认值。
LingyuCoder marked this conversation as resolved.
Show resolved Hide resolved

## CommonJS

Rspack 也支持 `CommonJS` 语法,可以使用 `require` 和 `module.exports` 语法。
Expand Down
Loading