Skip to content

Commit 48bea10

Browse files
authored
Merge pull request #1567 from docschina/sync-4b5c7476
docs(en): merge webpack.js.org/master into webpack.js.org/cn @ 4b5c747
2 parents 5b0060a + 4810efa commit 48bea10

File tree

15 files changed

+1746
-1709
lines changed

15 files changed

+1746
-1709
lines changed

examples/module-federation/app1/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
<title>App 1</title>
66
</head>
77
<body>
8-
<div id="root"/>
8+
<div id="root"></div>
99
</body>
1010
</html>

examples/module-federation/app2/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
<title>App 2</title>
66
</head>
77
<body>
8-
<div id="root"/>
8+
<div id="root"></div>
99
</body>
1010
</html>

package.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -73,54 +73,54 @@
7373
]
7474
},
7575
"devDependencies": {
76-
"@babel/core": "^7.17.9",
77-
"@babel/eslint-parser": "^7.17.0",
78-
"@babel/plugin-proposal-class-properties": "^7.16.7",
79-
"@babel/preset-env": "^7.16.11",
80-
"@babel/preset-react": "^7.16.7",
76+
"@babel/core": "^7.18.2",
77+
"@babel/eslint-parser": "^7.18.2",
78+
"@babel/plugin-proposal-class-properties": "^7.17.12",
79+
"@babel/preset-env": "^7.18.0",
80+
"@babel/preset-react": "^7.17.12",
8181
"@mdx-js/loader": "^2.0.0-next.9",
8282
"@octokit/auth-action": "^1.3.3",
8383
"@octokit/rest": "^18.12.0",
84-
"@parcel/css": "^1.8.1",
84+
"@parcel/css": "^1.9.0",
8585
"@pmmmwh/react-refresh-webpack-plugin": "next",
8686
"@svgr/webpack": "^6.2.1",
87-
"autoprefixer": "^10.4.4",
88-
"babel-loader": "^8.2.4",
89-
"copy-webpack-plugin": "^10.2.4",
87+
"autoprefixer": "^10.4.7",
88+
"babel-loader": "^8.2.5",
89+
"copy-webpack-plugin": "^11.0.0",
9090
"css-loader": "^6.7.1",
91-
"css-minimizer-webpack-plugin": "^3.4.1",
92-
"cypress": "^9.5.4",
93-
"directory-tree": "^3.2.2",
91+
"css-minimizer-webpack-plugin": "^4.0.0",
92+
"cypress": "^9.7.0",
93+
"directory-tree": "^3.3.0",
9494
"directory-tree-webpack-plugin": "^1.0.3",
9595
"duplexer": "^0.1.1",
96-
"eslint": "^8.13.0",
96+
"eslint": "^8.16.0",
9797
"eslint-config-prettier": "^8.5.0",
9898
"eslint-plugin-cypress": "^2.12.1",
9999
"eslint-plugin-mdx": "^1.17.0",
100-
"eslint-plugin-react": "^7.29.4",
101-
"eslint-plugin-react-hooks": "^4.4.0",
100+
"eslint-plugin-react": "^7.30.0",
101+
"eslint-plugin-react-hooks": "^4.5.0",
102102
"front-matter": "^4.0.2",
103103
"github-slugger": "^1.4.0",
104104
"html-loader": "^2.1.2",
105105
"html-webpack-plugin": "^5.5.0",
106106
"http-server": "^14.1.0",
107-
"husky": "^7.0.4",
107+
"husky": "^8.0.1",
108108
"hyperlink": "^5.0.4",
109-
"jest": "^27.5.1",
110-
"lint-staged": "^12.3.8",
109+
"jest": "^28.1.0",
110+
"lint-staged": "^12.4.3",
111111
"lodash": "^4.17.21",
112112
"markdownlint": "^0.25.1",
113113
"markdownlint-cli": "^0.31.1",
114114
"mdast-util-to-string": "^3.1.0",
115115
"mini-css-extract-plugin": "^2.6.0",
116116
"mkdirp": "^1.0.4",
117117
"modularscale-sass": "^3.0.3",
118-
"node-fetch": "^3.2.3",
118+
"node-fetch": "^3.2.4",
119119
"npm-run-all": "^4.1.1",
120-
"postcss": "^8.4.12",
121-
"postcss-loader": "^6.2.1",
120+
"postcss": "^8.4.14",
121+
"postcss-loader": "^7.0.0",
122122
"prettier": "^2.6.2",
123-
"react-refresh": "^0.12.0",
123+
"react-refresh": "^0.13.0",
124124
"redirect-webpack-plugin": "^1.0.0",
125125
"remark": "^14.0.2",
126126
"remark-autolink-headings": "7.0.1",
@@ -131,22 +131,22 @@
131131
"remark-html": "^15.0.1",
132132
"remark-refractor": "montogeek/remark-refractor",
133133
"rimraf": "^3.0.2",
134-
"sass": "^1.50.1",
135-
"sass-loader": "^12.6.0",
134+
"sass": "^1.52.1",
135+
"sass-loader": "^13.0.0",
136136
"sirv-cli": "^2.0.2",
137137
"sitemap-static": "^0.4.2",
138138
"start-server-and-test": "^1.14.0",
139139
"static-site-generator-webpack-plugin": "^3.4.1",
140140
"style-loader": "^3.3.1",
141141
"tailwindcss": "^3.0.24",
142-
"tap-spot": "^1.1.1",
142+
"tap-spot": "^1.1.2",
143143
"textlint": "^11.8.2",
144144
"textlint-rule-heading": "^1.0.10",
145145
"unist-util-visit": "^4.1.0",
146-
"webpack": "^5.72.0",
146+
"webpack": "^5.72.1",
147147
"webpack-bundle-analyzer": "^4.5.0",
148148
"webpack-cli": "^4.9.2",
149-
"webpack-dev-server": "^4.8.1",
149+
"webpack-dev-server": "^4.9.0",
150150
"webpack-merge": "^5.8.0",
151151
"workbox-webpack-plugin": "^6.5.3"
152152
},
@@ -158,9 +158,9 @@
158158
"react-dom": "^17.0.2",
159159
"react-helmet-async": "^1.3.0",
160160
"react-router-dom": "^6.3.0",
161-
"react-spring": "^9.4.4",
161+
"react-spring": "^9.4.5",
162162
"react-tiny-popover": "5",
163-
"react-use": "^17.3.2",
163+
"react-use": "^17.4.0",
164164
"react-visibility-sensor": "^5.0.2",
165165
"webpack-pwa-manifest": "^4.3.0",
166166
"webpack.vote": "https://github.com/webpack/voting-app.git",

src/assets/ag-grid-logo.png

133 Bytes
Loading

src/components/Dropdown/Dropdown.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export default class Dropdown extends Component {
156156
/**
157157
* Toggle visibility of dropdown items
158158
*
159-
* @param {bool} state - Whether to display or hide the items
159+
* @param {boolean} state - Whether to display or hide the items
160160
*/
161161
_toggle(state = false) {
162162
this.setState({

src/components/SidebarItem/SidebarItem.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default class SidebarItem extends Component {
6969
render() {
7070
let { title, anchors = [] } = this.props;
7171
let openMod = this.state.open ? `${block}--open` : '';
72-
let disabledMod = anchors.length == 0 ? `${block}--disabled` : '';
72+
let disabledMod = anchors.length === 0 ? `${block}--disabled` : '';
7373

7474
const filteredAnchors = anchors.filter((anchor) => anchor.level > 1);
7575
const tree = list2Tree(title, filteredAnchors);

src/content/api/hot-module-replacement.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if (module.hot) {
3333
// or
3434
if (import.meta.webpackHot) {
3535
import.meta.webpackHot.accept('./library.js', function () {
36-
// Do something with the updated library modue
36+
// Do something with the updated library module
3737
});
3838
}
3939
```

src/content/api/loaders.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,15 @@ addDependency(file: string)
213213
dependency(file: string) // shortcut
214214
```
215215

216-
加入一个文件作为产生 loader 结果的依赖,使它们的任何变化可以被监听到。例如,[`sass-loader`](https://github.com/webpack-contrib/sass-loader), [`less-loader`](https://github.com/webpack-contrib/less-loader) 就使用了这个技巧,当它发现无论何时导入的 `css` 文件发生变化时就会重新编译。
216+
添加一个文件作为产生 loader 结果的依赖,使它们的任何变化可以被监听到。例如,[`sass-loader`](https://github.com/webpack-contrib/sass-loader), [`less-loader`](https://github.com/webpack-contrib/less-loader) 就使用了这个技巧,当它发现无论何时导入的 `css` 文件发生变化时就会重新编译。
217+
218+
### this.addMissingDependency $#thisaddmissingdependency$
219+
220+
```typescript
221+
addMissingDependency(file: string)
222+
```
223+
224+
添加一个不存在的文件作为 loader 结果的依赖项,以使它们可监听。类似于 `addDependency`,但是会在正确附加观察者之前处理在编译期间文件的创建。
217225

218226
### this.async $#thisasync$
219227

src/content/configuration/module.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,25 @@ const x = require(/* webpackIgnore: true */ 'x');
206206
};
207207
```
208208

209+
#### module.parser.javascript.importMeta
210+
211+
Enable or disable evaluating `import.meta`.
212+
213+
- Type: `boolean = true`
214+
- Available: 5.68.0+
215+
- Example:
216+
```js
217+
module.exports = {
218+
module: {
219+
parser: {
220+
javascript: {
221+
importMeta: false,
222+
},
223+
},
224+
},
225+
};
226+
```
227+
209228
#### module.parser.javascript.importMetaContext
210229

211230
启用/禁用 [`import.meta.webpackContext`](/api/module-variables/#importmetawebpackcontext) 分析。

src/content/guides/asset-modules.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ import mainImage from './images/main.png';
113113
img.src = mainImage; // '/dist/151cfcfa1bd74779aadb.png'
114114
```
115115

116-
所有 `.png` 文件都将被发送到输出目录,并且其路径将被注入到 bundle 中。
116+
所有 `.png` 文件都将被发送到输出目录,并且其路径将被注入到 bundle 中,除此之外,你可以为它们自定义 [`outputPath`](/configuration/module/#rulegeneratoroutputpath)[`publicPath`](/configuration/module/#rulegeneratorpublicpath) 属性
117117

118118
### 自定义输出文件名 $#custom-output-filename$
119119

src/content/plugins/split-chunks-plugin.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ T> 设置 `maxSize` 的值会同时设置 `maxAsyncSize` 和 `maxInitialSize`
254254

255255
如果 `splitChunks.name`[entry point](/configuration/entry-context/#entry) 名称匹配,entry point 将被删除。
256256

257+
T> `splitChunks.cacheGroups.{cacheGroup}.name` can be used to move modules into a chunk that is a parent of the source chunk. For example, use `name: "entry-name"` to move modules into the `entry-name` chunk. You can also use on demand named chunks, but you must be careful that the selected modules are only used under this chunk.
258+
257259
**main.js**
258260

259261
```js

src/scripts/build-content-tree.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function buildContentTree(source, output) {
4343

4444
fs.writeFileSync(
4545
path.resolve(output),
46-
JSON.stringify(content, 2),
46+
JSON.stringify(content, null, 2),
4747
(error) => {
4848
if (error) {
4949
console.log('scripts/build-content-tree', error);

src/scripts/concatenate-docs.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import W${basename} from './${file}'
6161

6262
if (
6363
left.sort > right.sort ||
64-
(left.sort == right.sort && left.title > right.title)
64+
(left.sort === right.sort && left.title > right.title)
6565
) {
6666
[fileContents[i], fileContents[j]] = [
6767
fileContents[j],

src/utilities/test-local-storage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Test if localStorage is enabled.
33
*
44
* {@link https://github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js}
5-
* @return {undefined|bool} Returns false on error.
5+
* @return {undefined|boolean} Returns false on error.
66
*/
77
module.exports = function () {
88
const test = 'localStorageTest';

0 commit comments

Comments
 (0)