From 3e9e8c5efd6c119acdd8571dd7bc9fa7a4d08cea Mon Sep 17 00:00:00 2001 From: LingyuCoder Date: Thu, 4 Jul 2024 13:33:40 +0800 Subject: [PATCH 1/2] docs: add fetch priority --- website/docs/en/api/modules/module-methods.mdx | 9 +++++++++ website/docs/zh/api/modules/module-methods.mdx | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/website/docs/en/api/modules/module-methods.mdx b/website/docs/en/api/modules/module-methods.mdx index 76a2f680e74..e94098c7989 100644 --- a/website/docs/en/api/modules/module-methods.mdx +++ b/website/docs/en/api/modules/module-methods.mdx @@ -109,6 +109,7 @@ import( /* webpackPreload: true */ /* webpackMode: "lazy" */ /* webpackIgnore: true */ + /* webpackFetchPriority: "high" */ 'module' ); ``` @@ -162,6 +163,14 @@ Tells the browser that the resource might be needed during the current navigatio A name for the new chunk. +##### webpackFetchPriority + + + +- **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. + ## CommonJS Rspack is also support `CommonJS` syntax natively, you can use `require` and `module.exports` methods. diff --git a/website/docs/zh/api/modules/module-methods.mdx b/website/docs/zh/api/modules/module-methods.mdx index fd3ff85ffb8..cd327f3889a 100644 --- a/website/docs/zh/api/modules/module-methods.mdx +++ b/website/docs/zh/api/modules/module-methods.mdx @@ -107,6 +107,7 @@ import( /* webpackPreload: true */ /* webpackMode: "lazy" */ /* webpackIgnore: true */ + /* webpackFetchPriority: "high" */ 'module' ); ``` @@ -160,6 +161,14 @@ import( 指定新 chunk 的名称。 +##### webpackFetchPriority + + + +- **Type:**: `"low" | "high" | "auto"` + +为指定的动态导入设置 [`fetchPriority`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchPriority)。也可以通过使用 `module.parser.javascript.dynamicImportFetchPriority` 选项为所有动态导入设置全局默认值。 + ## CommonJS Rspack 也支持 `CommonJS` 语法,可以使用 `require` 和 `module.exports` 语法。 From 230d839f7f3ee758aa64dcaa2b46524c4ae66fe3 Mon Sep 17 00:00:00 2001 From: LingyuCoder Date: Thu, 4 Jul 2024 13:36:16 +0800 Subject: [PATCH 2/2] docs: add fetch priority --- website/docs/zh/api/modules/module-methods.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/zh/api/modules/module-methods.mdx b/website/docs/zh/api/modules/module-methods.mdx index cd327f3889a..db742a12245 100644 --- a/website/docs/zh/api/modules/module-methods.mdx +++ b/website/docs/zh/api/modules/module-methods.mdx @@ -165,7 +165,7 @@ import( -- **Type:**: `"low" | "high" | "auto"` +- **类型:**: `"low" | "high" | "auto"` 为指定的动态导入设置 [`fetchPriority`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/fetchPriority)。也可以通过使用 `module.parser.javascript.dynamicImportFetchPriority` 选项为所有动态导入设置全局默认值。