Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c520f21
docs(concepts): add note about deprecated CLI usage for loaders (#5916)
chenxsan Jan 29, 2022
6e0fed8
build(deps-dev): bump copy-webpack-plugin from 10.2.1 to 10.2.2 (#5915)
dependabot[bot] Jan 30, 2022
5bc6500
build(deps-dev): bump eslint from 8.7.0 to 8.8.0 (#5920)
dependabot[bot] Feb 1, 2022
238c76a
build(deps-dev): bump tailwindcss from 3.0.17 to 3.0.18 (#5923)
dependabot[bot] Feb 1, 2022
2624ab4
build(deps-dev): bump webpack from 5.67.0 to 5.68.0 (#5922)
dependabot[bot] Feb 1, 2022
4aa99de
build(deps-dev): bump @svgr/webpack from 6.2.0 to 6.2.1 (#5921)
dependabot[bot] Feb 1, 2022
17241db
build(deps-dev): bump copy-webpack-plugin from 10.2.2 to 10.2.4 (#5924)
dependabot[bot] Feb 1, 2022
22a4681
docs: avoid `Badge` in heading (#5926)
snitin315 Feb 1, 2022
bb60545
build(deps-dev): bump lint-staged from 12.3.2 to 12.3.3 (#5930)
dependabot[bot] Feb 1, 2022
f93fbd1
build(deps-dev): bump postcss from 8.4.5 to 8.4.6 (#5934)
dependabot[bot] Feb 1, 2022
e0911c6
build(deps-dev): bump directory-tree from 3.0.1 to 3.1.0 (#5932)
dependabot[bot] Feb 2, 2022
57e5c08
docs(configuration): update `externals` option types (#5936)
snitin315 Feb 2, 2022
f857953
build(deps-dev): bump sass from 1.49.0 to 1.49.7 (#5935)
dependabot[bot] Feb 2, 2022
a34a46b
docs(configuration): update `devServer` option types (#5937)
snitin315 Feb 2, 2022
91675d2
build(deps-dev): bump cypress from 9.3.1 to 9.4.1 (#5931)
dependabot[bot] Feb 2, 2022
7d6bc78
docs(api): add `__webpack_module__` and `__webpack_module__.id` (#5925)
snitin315 Feb 3, 2022
0197662
build(deps-dev): bump css-loader from 6.5.1 to 6.6.0 (#5940)
dependabot[bot] Feb 3, 2022
abdf777
docs(configuration): fix link to Node.js docs (#5938)
vankop Feb 3, 2022
4c1dcbc
build(deps-dev): bump webpack-dev-server from 4.7.3 to 4.7.4 (#5939)
dependabot[bot] Feb 3, 2022
a20f6e1
docs(en): merging all conflicts
docschina-bot Feb 3, 2022
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
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,17 @@
"@octokit/auth-action": "^1.3.3",
"@octokit/rest": "^18.12.0",
"@pmmmwh/react-refresh-webpack-plugin": "next",
"@svgr/webpack": "^6.2.0",
"@svgr/webpack": "^6.2.1",
"autoprefixer": "^10.4.2",
"babel-loader": "^8.2.3",
"copy-webpack-plugin": "^10.2.1",
"css-loader": "^6.5.1",
"copy-webpack-plugin": "^10.2.4",
"css-loader": "^6.6.0",
"css-minimizer-webpack-plugin": "^3.4.1",
"cypress": "^9.3.1",
"directory-tree": "^3.0.1",
"cypress": "^9.4.1",
"directory-tree": "^3.1.0",
"directory-tree-webpack-plugin": "^1.0.3",
"duplexer": "^0.1.1",
"eslint": "^8.7.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-mdx": "^1.16.0",
Expand All @@ -106,7 +106,7 @@
"husky": "^7.0.4",
"hyperlink": "^5.0.4",
"jest": "^27.4.7",
"lint-staged": "^12.3.2",
"lint-staged": "^12.3.3",
"lodash": "^4.17.21",
"markdownlint": "^0.25.1",
"markdownlint-cli": "^0.30.0",
Expand All @@ -116,7 +116,7 @@
"modularscale-sass": "^3.0.3",
"node-fetch": "^3.2.0",
"npm-run-all": "^4.1.1",
"postcss": "^8.4.5",
"postcss": "^8.4.6",
"postcss-loader": "^6.2.1",
"prettier": "^2.5.1",
"react-refresh": "^0.11.0",
Expand All @@ -131,22 +131,22 @@
"remark-refractor": "montogeek/remark-refractor",
"remark-slug": "^7.0.1",
"rimraf": "^3.0.2",
"sass": "^1.49.0",
"sass": "^1.49.7",
"sass-loader": "^12.4.0",
"sirv-cli": "^2.0.2",
"sitemap-static": "^0.4.2",
"start-server-and-test": "^1.14.0",
"static-site-generator-webpack-plugin": "^3.4.1",
"style-loader": "^3.3.1",
"tailwindcss": "^3.0.17",
"tailwindcss": "^3.0.18",
"tap-spot": "^1.1.1",
"textlint": "^11.8.2",
"textlint-rule-heading": "^1.0.10",
"unist-util-visit": "^4.1.0",
"webpack": "^5.67.0",
"webpack": "^5.68.0",
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.7.3",
"webpack-dev-server": "^4.7.4",
"webpack-merge": "^5.8.0",
"workbox-webpack-plugin": "^6.4.2"
},
Expand Down
17 changes: 17 additions & 0 deletions src/content/api/module-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ contributors:
- anikethsaha
- chenxsan
- jamesgeorge007
- snitin315
related:
- title: CommonJS
url: https://en.wikipedia.org/wiki/CommonJS
Expand Down Expand Up @@ -168,7 +169,23 @@ import('./module-a').then((moduleA) => {
});
```

<<<<<<< HEAD
## \_\_webpack_modules\_\_ (webpack-specific) $#__webpack_modules__-webpack-specific$
=======
## \_\_webpack_module\_\_ (webpack-specific)

<Badge text="5.68.0+" />

It provides access to the the current `module`. `module` is not available in strict ESM.

## \_\_webpack_module\_\_.id (webpack-specific)

<Badge text="5.68.0+" />

It provides access to the ID of current `module` (`module.id`). `module` is not available in strict ESM.

## \_\_webpack_modules\_\_ (webpack-specific)
>>>>>>> 4c1dcbcf99dab7a727a0b3848aced276f91d1027

访问所有模块的内部对象。

Expand Down
6 changes: 6 additions & 0 deletions src/content/concepts/loaders.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ module.exports = {
- [配置方式](#configuration)(推荐):在 **webpack.config.js** 文件中指定 loader。
- [内联方式](#inline):在每个 `import` 语句中显式指定 loader。

<<<<<<< HEAD
### 配置方式 $#configuration$
=======
Note that loaders can be used from CLI under webpack v4, but the feature was deprecated in webpack v5.

### Configuration
>>>>>>> 4c1dcbcf99dab7a727a0b3848aced276f91d1027

[`module.rules`](/configuration/module/#modulerules) 允许你在 webpack 配置中指定多个 loader。
这种方式是展示 loader 的一种简明方式,并且有助于使代码变得简洁和易于维护。同时让你对各个 loader 有个全局概览:
Expand Down
6 changes: 3 additions & 3 deletions src/content/configuration/dev-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ module.exports = {

## devServer.open $#devserveropen$

`boolean` `string` `[string]` `object` `[object]`
`boolean` `string` `object` `[string, object]`

告诉 dev-server 在服务器已经启动后打开浏览器。设置其为 `true` 以打开你的默认浏览器。

Expand Down Expand Up @@ -1615,7 +1615,7 @@ module.exports = {

## devServer.static $#devserverstatic$

`boolean` `string` `[string]` `object` `[object]`
`boolean` `string` `object` `[string, object]`

该配置项允许配置从目录提供静态文件的选项(默认是 'public' 文件夹)。将其设置为 `false` 以禁用:

Expand Down Expand Up @@ -1885,7 +1885,7 @@ module.exports = {

## devServer.watchFiles $#devserverwatchfiles$

`string` `[string]` `object` `[object]`
`string` `object` `[string, object]`

该配置项允许你配置 globs/directories/files 来监听文件变化。例如:

Expand Down
2 changes: 1 addition & 1 deletion src/content/configuration/externals.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ translators:

## externals $#externals$

`string` `[string]` `object` `function` `RegExp`
`string` `object` `function` `RegExp` `[string, object, function, RegExp]`

**防止**将某些 `import` 的包(package)**打包**到 bundle 中,而是在运行时(runtime)再去从外部获取这些*扩展依赖(external dependencies)*。

Expand Down
18 changes: 17 additions & 1 deletion src/content/configuration/output.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,11 @@ module.exports = {

`string = 'hex'`

<<<<<<< HEAD
在生成 hash 时使用的编码方式。支持 Node.js [`hash.digest`](https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding) 的所有编码。对文件名使用 `'base64'`,可能会出现问题,因为 base64 字母表中具有 `/` 这个字符(character)。同样的,`'latin1'` 规定可以含有任何字符(character)。
=======
The encoding to use when generating the hash. All encodings from Node.JS' [`hash.digest`](https://nodejs.org/api/buffer.html#buffers-and-character-encodings) are supported. Using `'base64'` for filenames might be problematic since it has the character `/` in its alphabet. Likewise `'latin1'` could contain any character.
>>>>>>> 4c1dcbcf99dab7a727a0b3848aced276f91d1027

## output.hashDigestLength $#outputhashdigestlength$

Expand Down Expand Up @@ -970,7 +974,13 @@ MyLibrary = _entry_return_;

请注意,如果 `MyLibrary` 没有在你的库之前定义,那么它将会被设置在全局作用域。

<<<<<<< HEAD
##### type: 'assign-properties' <Badge text='5.16.0+' /> $#typeassignproperties$
=======
##### type: 'assign-properties'

<Badge text="5.16.0+" />
>>>>>>> 4c1dcbcf99dab7a727a0b3848aced276f91d1027

```js
module.exports = {
Expand Down Expand Up @@ -1151,7 +1161,7 @@ T> 在考虑 CommonJS 与 CommonJS2 之间的区别?虽然它们很相似,

##### type: 'commonjs-static' $#type-commonjsstatic$

<Badge text='5.66.0+' />
<Badge text="5.66.0+" />

```js
module.exports = {
Expand Down Expand Up @@ -1620,7 +1630,13 @@ MyLibrary = _entry_return_;

注意,如果 `MyLibrary` 在作用域中未在前面代码进行定义,则你的 library 将被设置在全局作用域内。

<<<<<<< HEAD
#### libraryTarget: 'assign-properties' <Badge text='5.16.0+' /> $#libraryTarget-assign-properties$
=======
#### libraryTarget: 'assign-properties'

<Badge text="5.16.0+" />
>>>>>>> 4c1dcbcf99dab7a727a0b3848aced276f91d1027

W> 最好使用 [output.library.type: 'assign-properties'`](#type-assign-properties)。

Expand Down
Loading