Skip to content

Commit d5268ad

Browse files
authored
Merge pull request #1624 from docschina/sync-2b1aaf87
docs(en): merge webpack.js.org/master into webpack.js.org/cn @ 2b1aaf8
2 parents 7ed6613 + d32b8f2 commit d5268ad

File tree

10 files changed

+557
-634
lines changed

10 files changed

+557
-634
lines changed

.github/workflows/deploy.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ jobs:
2323
node-version: ${{ matrix.node-version }}
2424
cache: yarn
2525

26+
- name: Enable webpack persistent caching
27+
uses: actions/cache@v3
28+
id: build-webpack-persistent-cache
29+
with:
30+
path: node_modules/.cache
31+
key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
32+
restore-keys: |-
33+
build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
34+
build-${{ hashFiles('**/webpack.*.mjs') }}-
35+
2636
- run: yarn --frozen-lockfile
2737
- name: Build site
2838
run: yarn build

.github/workflows/testing.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ jobs:
5858

5959
- run: yarn
6060

61+
- name: Enable webpack persistent caching
62+
uses: actions/cache@v3
63+
id: build-webpack-persistent-cache
64+
with:
65+
path: node_modules/.cache
66+
key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
67+
restore-keys: |-
68+
build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
69+
build-${{ hashFiles('**/webpack.*.mjs') }}-
70+
6171
- name: Build site
6272
run: yarn build
6373
env:
@@ -74,6 +84,16 @@ jobs:
7484
steps:
7585
- uses: actions/checkout@v3
7686

87+
- name: Enable webpack persistent caching
88+
uses: actions/cache@v3
89+
id: build-webpack-persistent-cache
90+
with:
91+
path: node_modules/.cache
92+
key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
93+
restore-keys: |-
94+
build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }}
95+
build-${{ hashFiles('**/webpack.*.mjs') }}-
96+
7797
- name: Cypress run
7898
uses: cypress-io/github-action@v4
7999
with:

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ $ yarn start
3737

3838
内容在 [Creative Commons BY 4.0](https://creativecommons.org/licenses/by/4.0/) 许可下可用。
3939

40-
[webpack5-milestone-url]: https://github.com/webpack/webpack.js.org/issues?q=is%3Aopen+is%3Aissue+milestone%3A%22webpack+5%22
4140
[build-status]: https://github.com/webpack/webpack.js.org/workflows/Deploy/badge.svg
4241
[build-status-url]: https://github.com/webpack/webpack.js.org/actions
4342
[chat]: https://badges.gitter.im/webpack/webpack.svg

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"cypress:open": "cypress open",
6060
"cypress:run": "cypress run",
6161
"prettier": "prettier --write '**/*.{js,json,jsx,css,scss,md,mdx}'",
62-
"prepare": "husky install"
62+
"prepare": "husky install",
63+
"postinstall": "rimraf ./node_modules/.cache/webpack"
6364
},
6465
"lint-staged": {
6566
"*.{js,jsx,md,mdx}": [
@@ -73,27 +74,27 @@
7374
]
7475
},
7576
"devDependencies": {
76-
"@babel/core": "^7.18.6",
77-
"@babel/eslint-parser": "^7.18.2",
77+
"@babel/core": "^7.18.9",
78+
"@babel/eslint-parser": "^7.18.9",
7879
"@babel/plugin-proposal-class-properties": "^7.17.12",
79-
"@babel/preset-env": "^7.18.6",
80+
"@babel/preset-env": "^7.18.9",
8081
"@babel/preset-react": "^7.18.6",
8182
"@mdx-js/loader": "^2.0.0-next.9",
8283
"@octokit/auth-action": "^2.0.0",
8384
"@octokit/rest": "^19.0.3",
8485
"@parcel/css": "^1.12.0",
8586
"@pmmmwh/react-refresh-webpack-plugin": "next",
86-
"@svgr/webpack": "^6.2.1",
87+
"@svgr/webpack": "^6.3.1",
8788
"autoprefixer": "^10.4.7",
8889
"babel-loader": "^8.2.5",
8990
"copy-webpack-plugin": "^11.0.0",
9091
"css-loader": "^6.7.1",
9192
"css-minimizer-webpack-plugin": "^4.0.0",
92-
"cypress": "^10.3.0",
93+
"cypress": "^10.3.1",
9394
"directory-tree": "^3.3.0",
9495
"directory-tree-webpack-plugin": "^1.0.3",
9596
"duplexer": "^0.1.1",
96-
"eslint": "^8.19.0",
97+
"eslint": "^8.20.0",
9798
"eslint-config-prettier": "^8.5.0",
9899
"eslint-plugin-cypress": "^2.12.1",
99100
"eslint-plugin-mdx": "^2.0.1",
@@ -110,12 +111,12 @@
110111
"lint-staged": "^13.0.3",
111112
"lodash": "^4.17.21",
112113
"markdownlint": "^0.26.0",
113-
"markdownlint-cli": "^0.31.1",
114+
"markdownlint-cli": "^0.32.0",
114115
"mdast-util-to-string": "^3.1.0",
115116
"mini-css-extract-plugin": "^2.6.1",
116117
"mkdirp": "^1.0.4",
117118
"modularscale-sass": "^3.0.3",
118-
"node-fetch": "^3.2.8",
119+
"node-fetch": "^3.2.9",
119120
"npm-run-all": "^4.1.1",
120121
"postcss": "^8.4.14",
121122
"postcss-loader": "^7.0.1",
@@ -157,7 +158,7 @@
157158
"react-dom": "^17.0.2",
158159
"react-helmet-async": "^1.3.0",
159160
"react-router-dom": "^6.3.0",
160-
"react-spring": "^9.5.0",
161+
"react-spring": "^9.5.1",
161162
"react-tiny-popover": "5",
162163
"react-use": "^17.4.0",
163164
"react-visibility-sensor": "^5.0.2",

src/content/guides/code-splitting.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ webpack-demo
318318
-
319319
-function component() {
320320
+function getComponent() {
321-
const element = document.createElement('div');
321+
- const element = document.createElement('div');
322322

323323
- // Lodash, now imported by this script
324324
- element.innerHTML = _.join(['Hello', 'webpack'], ' ');
@@ -363,7 +363,7 @@ webpack 5.4.0 compiled successfully in 268 ms
363363
```diff
364364
-function getComponent() {
365365
+async function getComponent() {
366-
const element = document.createElement('div');
366+
+ const element = document.createElement('div');
367367
+ const { default: _ } = await import('lodash');
368368

369369
- return import('lodash')

src/content/plugins/module-concatenation-plugin.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,12 @@ function tryToAdd(group, module) {
8484

8585
### Debugging Optimization Bailouts $#debugging-optimization-bailouts$
8686

87-
When using the webpack CLI, the `--display-optimization-bailout` flag will display bailout reasons. When using the webpack config, add the following to the `stats` object:
87+
When using the webpack CLI, the `--stats-optimization-bailout` flag will display bailout reasons. When using the webpack config, add the following to the `stats` object:
8888

8989
```js
9090
module.exports = {
9191
//...
9292
stats: {
93-
// Examine all modules
94-
maxModules: Infinity,
9593
// Display bailout reasons
9694
optimizationBailout: true,
9795
},

webpack.common.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default ({ ssg = false }) => ({
5555
buildDependencies: {
5656
config: [__filename],
5757
},
58-
cacheDirectory: path.resolve(__dirname, '.cache/webpack'),
58+
cacheDirectory: path.resolve(__dirname, 'node_modules/.cache/webpack')
5959
},
6060
resolve: {
6161
extensions: ['.js', '.jsx', '.scss'],

webpack.prod.mjs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ import ProdAssetsManifest from './src/ProdAssetsManifest.mjs';
1515
export default (env) =>
1616
merge(common(env), {
1717
mode: 'production',
18-
cache: {
19-
buildDependencies: {
20-
config: [__filename],
21-
},
22-
},
2318
entry: {
2419
index: {
2520
import: './index.jsx',

webpack.ssg.mjs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ export default (env) =>
2424
name: 'ssg',
2525
mode: 'production',
2626
target: 'node',
27-
cache: {
28-
buildDependencies: {
29-
config: [__filename],
30-
},
31-
},
3227
module: {
3328
parser: {
3429
javascript: {

0 commit comments

Comments
 (0)