Skip to content

Commit d5bd575

Browse files
docs(cn): 更新 externalsType 三个变量的翻译 (#1555)
* Update externals.mdx 更新externalsType的三个变量的翻译 * Update src/content/configuration/externals.mdx Co-authored-by: Jacob <[email protected]> * Update src/content/configuration/externals.mdx Co-authored-by: Jacob <[email protected]> * Update src/content/configuration/externals.mdx Co-authored-by: Jacob <[email protected]> * Update src/content/configuration/externals.mdx Co-authored-by: Jacob <[email protected]> * Update src/content/configuration/externals.mdx Co-authored-by: Jacob <[email protected]> * Update src/content/configuration/externals.mdx Co-authored-by: Jacob <[email protected]> Co-authored-by: Jacob <[email protected]>
1 parent 48bea10 commit d5bd575

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/content/configuration/externals.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,9 @@ module.exports = {
360360

361361
### externalsType.module $#externalstype-module$
362362

363-
Specify the default type of externals as `'module'`. Webpack will generate code like `import * as X from '...'` for externals used in a module.
363+
externals 类型设置为 `'module'`,webpack 将会在 module 中为外部引用生成形如 `import * as X from '...'` 的代码。
364364

365-
Make sure to enable [`experiments.outputModule`](/configuration/experiments/#experimentsoutputmodule) first, otherwise webpack will throw errors.
365+
确保首先把 [`experiments.outputModule`](/configuration/experiments/#experimentsoutputmodule) 设置为 `true`, 否则 webpack 将会报错。
366366

367367
**webpack.config.js**
368368

@@ -375,9 +375,9 @@ module.exports = {
375375
};
376376
```
377377

378-
### externalsType.node-commonjs
378+
### externalsType.node-commonjs $#externalstype-node-commonjs$
379379

380-
Specify the default type of externals as `'node-commonjs'`. Webpack will import [`createRequire`](https://nodejs.org/api/module.html#module_module_createrequire_filename) from `'module'` to construct a require function for loading externals used in a module.
380+
externals 类型设置为 `'node-commonjs'`,webpack 将从 `module` 中导入 `createRequire` 来构造一个 require 函数,用于加载模块中使用的外部对象。
381381

382382
```js
383383
module.export = {
@@ -388,9 +388,9 @@ module.export = {
388388
};
389389
```
390390

391-
### externalsType.script
391+
### externalsType.script $#externalstype-script$
392392

393-
Specify the default type of externals as `'script'`. Webpack will Load the external as a script exposing predefined global variables with HTML `<script>` element. The `<script>` tag would be removed after the script has been loaded.
393+
externals 类型设置为 `'script'`,webpack 将会通过 HTML 中的 `<script>` 标签加载一个脚本,以暴露预定义的全局变量。当脚本被加载完后 `<script>` 标签会被删除。
394394

395395
#### Syntax $#syntax$
396396

0 commit comments

Comments
 (0)