Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(en): merge webpack.js.org/master into webpack.js.org/cn @ 39f5e665 #1702

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c88ec92
docs(configuration): move `name` option to correct place (#6407)
Coly010 Sep 20, 2022
a82ed1b
build(deps-dev): bump webpack-dev-server from 4.11.0 to 4.11.1 (#6409)
dependabot[bot] Sep 20, 2022
3b68bd6
build(deps-dev): bump eslint-plugin-mdx from 2.0.4 to 2.0.5 (#6410)
dependabot[bot] Sep 20, 2022
7c2cc4e
docs(guides): add emit section for asset modules (#6411)
chenxsan Sep 21, 2022
a061579
build(deps-dev): bump lightningcss from 1.15.1 to 1.16.0 (#6412)
dependabot[bot] Sep 21, 2022
1d43859
docs(api): improve logging api (#6413)
chenxsan Sep 21, 2022
9060a92
build(deps-dev): bump autoprefixer from 10.4.11 to 10.4.12 (#6414)
dependabot[bot] Sep 22, 2022
0ccd06c
build(deps-dev): bump sass from 1.54.9 to 1.55.0 (#6416)
dependabot[bot] Sep 23, 2022
97e2ef2
build(deps): bump react-router-dom from 6.4.0 to 6.4.1 (#6417)
dependabot[bot] Sep 23, 2022
10fd714
CI: running e2e tests with Chrome (#6415)
chenxsan Sep 23, 2022
bde990a
docs(configuration): mention default watchOptions.poll value (#6419)
chenxsan Sep 26, 2022
bbdd8bb
build(deps-dev): bump eslint from 8.23.1 to 8.24.0 (#6420)
dependabot[bot] Sep 27, 2022
f10a990
build(deps): bump react-spring from 9.5.4 to 9.5.5 (#6421)
dependabot[bot] Sep 27, 2022
af245f8
build(deps-dev): bump cypress from 10.8.0 to 10.9.0 (#6423)
dependabot[bot] Sep 28, 2022
9d46f0e
build(deps-dev): bump @babel/preset-env from 7.19.1 to 7.19.3 (#6424)
dependabot[bot] Sep 28, 2022
f71118f
build(deps-dev): bump @babel/core from 7.19.1 to 7.19.3 (#6425)
dependabot[bot] Sep 28, 2022
99724ef
build(deps-dev): bump css-minimizer-webpack-plugin from 4.1.0 to 4.2.…
dependabot[bot] Oct 1, 2022
e729946
build(deps-dev): bump jest from 29.0.3 to 29.1.2 (#6428)
dependabot[bot] Oct 1, 2022
d862d15
build(deps-dev): bump postcss from 8.4.16 to 8.4.17 (#6429)
dependabot[bot] Oct 1, 2022
7a820ae
build(deps-dev): bump @svgr/webpack from 6.3.1 to 6.4.0 (#6431)
dependabot[bot] Oct 4, 2022
6e78169
build(deps): bump react-router-dom from 6.4.1 to 6.4.2 (#6432)
dependabot[bot] Oct 7, 2022
39f5e66
build(deps-dev): bump css-minimizer-webpack-plugin from 4.2.0 to 4.2.…
dependabot[bot] Oct 7, 2022
331ab2c
docs(en): merging all conflicts
docschina-bot Oct 7, 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
1 change: 1 addition & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ jobs:
- name: Cypress run
uses: cypress-io/github-action@v4
with:
browser: chrome
config-file: cypress.config.js
build: yarn build
start: yarn serve-dist
Expand Down
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"printable": "node ./src/scripts/concatenate-docs.mjs",
"jest": "NODE_OPTIONS=--experimental-vm-modules jest --config=jest.config.mjs",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"cypress:run": "cypress run --browser chrome",
"prettier": "prettier --write '**/*.{js,json,jsx,css,scss,md,mdx}'",
"prepare": "husky install && rimraf ./node_modules/.cache/webpack && yarn-deduplicate --strategy fewer"
},
Expand All @@ -73,29 +73,29 @@
]
},
"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/core": "^7.19.3",
"@babel/eslint-parser": "^7.19.1",
"@babel/plugin-proposal-class-properties": "^7.17.12",
"@babel/preset-env": "^7.19.1",
"@babel/preset-env": "^7.19.3",
"@babel/preset-react": "^7.18.6",
"@mdx-js/loader": "^2.0.0-next.9",
"@octokit/auth-action": "^2.0.1",
"@octokit/rest": "^19.0.4",
"@pmmmwh/react-refresh-webpack-plugin": "next",
"@svgr/webpack": "^6.3.1",
"autoprefixer": "^10.4.11",
"@svgr/webpack": "^6.4.0",
"autoprefixer": "^10.4.12",
"babel-loader": "^8.2.5",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.1",
"css-minimizer-webpack-plugin": "^4.1.0",
"cypress": "^10.7.0",
"css-minimizer-webpack-plugin": "^4.2.1",
"cypress": "^10.9.0",
"directory-tree": "^3.3.1",
"directory-tree-webpack-plugin": "^1.0.3",
"duplexer": "^0.1.1",
"eslint": "^8.23.1",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-mdx": "^2.0.4",
"eslint-plugin-mdx": "^2.0.5",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"front-matter": "^4.0.2",
Expand All @@ -105,8 +105,8 @@
"http-server": "^14.1.1",
"husky": "^8.0.1",
"hyperlink": "^5.0.4",
"jest": "^29.0.3",
"lightningcss": "^1.15.1",
"jest": "^29.1.2",
"lightningcss": "^1.16.0",
"lint-staged": "^13.0.3",
"lodash": "^4.17.21",
"markdownlint": "^0.26.2",
Expand All @@ -117,7 +117,7 @@
"modularscale-sass": "^3.0.3",
"node-fetch": "^3.2.10",
"npm-run-all": "^4.1.1",
"postcss": "^8.4.16",
"postcss": "^8.4.17",
"postcss-loader": "^7.0.1",
"prettier": "^2.7.1",
"react-refresh": "^0.14.0",
Expand All @@ -131,7 +131,7 @@
"remark-html": "^15.0.1",
"remark-refractor": "montogeek/remark-refractor",
"rimraf": "^3.0.2",
"sass": "^1.54.9",
"sass": "^1.55.0",
"sass-loader": "^13.0.2",
"sirv-cli": "^2.0.2",
"sitemap-static": "^0.4.2",
Expand All @@ -145,7 +145,7 @@
"webpack": "^5.74.0",
"webpack-bundle-analyzer": "^4.6.1",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.0",
"webpack-dev-server": "^4.11.1",
"webpack-merge": "^5.8.0",
"workbox-webpack-plugin": "^6.5.4",
"yarn-deduplicate": "^6.0.0"
Expand All @@ -157,8 +157,8 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet-async": "^1.3.0",
"react-router-dom": "^6.4.0",
"react-spring": "^9.5.4",
"react-router-dom": "^6.4.2",
"react-spring": "^9.5.5",
"react-tiny-popover": "5",
"react-use": "^17.4.0",
"react-visibility-sensor": "^5.0.2",
Expand Down
11 changes: 11 additions & 0 deletions src/content/api/logging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,18 @@ module.exports = function (source) {
};
```

<<<<<<< HEAD
## Logger methods $#logger-methods$
=======
As you can see from the above `my-webpack-plugin.js` example, there're two types of logging methods,

1. `compilation.getLogger`
2. `compiler.getInfrastructureLogger`

It's advised to use `compilation.getLogger` when plugin/logging is related to the compilation, and they will be stored within the stats. For logging that happens outside the compilation cycle, use `compiler.getInfrastructureLogger` instead.

## Logger methods
>>>>>>> 39f5e66582331e4b289cdca7c4b051b25deb7829

- `logger.error(...)`:用于输出错误信息
- `logger.warn(...)`:用于输出警告信息
Expand Down
7 changes: 5 additions & 2 deletions src/content/configuration/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ contributors:
- bigdawggi
- anshumanv
- textbook
<<<<<<< HEAD
translators:
- dear-lizhihua
- QC-L
=======
- coly010
>>>>>>> 39f5e66582331e4b289cdca7c4b051b25deb7829
---

webpack 开箱即用,可以无需使用任何配置文件。然而,webpack 会假定项目的入口起点为 `src/index.js`,然后会在 `dist/main.js` 输出结果,并且在生产环境开启压缩和优化。
Expand Down Expand Up @@ -59,6 +63,7 @@ W> Notice that many array configurations allow to reference the default value vi
const path = require('path');

module.exports = {
name: "my-config", // name of the configuration, shown in output
<mode "/configuration/mode">
<default>
mode: "production", // "production" | "development" | "none"
Expand Down Expand Up @@ -181,8 +186,6 @@ module.exports = {
},
uniqueName: "my-application", // (defaults to package.json "name")
// unique name for this build to avoid conflicts with other builds in the same HTML
name: "my-config",
// name of the configuration, shown in output
<advancedOutput "#">
<default>
/* 高级输出配置(点击显示) */
Expand Down
8 changes: 8 additions & 0 deletions src/content/configuration/watch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ contributors:
- Neob91
- Loonride
- snitin315
<<<<<<< HEAD
translators:
- lcxfs1991
- QC-L
- jacob-lcs
=======
- chenxsan
>>>>>>> 39f5e66582331e4b289cdca7c4b051b25deb7829
---

Webpack 可以监听文件变化,当它们修改后会重新编译。这个页面介绍了如何启用这个功能,以及当 watch 无法正常运行的时候你可以做的一些调整。
Expand Down Expand Up @@ -132,7 +136,11 @@ T> 如果你使用 `require.context`,webpack 会监听你的整个目录。你

`boolean = false` `number`

<<<<<<< HEAD
通过传递 `true` 开启 [polling](https://whatis.techtarget.com/definition/polling),或者指定毫秒为单位进行轮询。
=======
Turn on [polling](<https://en.wikipedia.org/wiki/Polling_(computer_science)>) by passing `true` which would set the default poll interval to [`5007`](https://github.com/webpack/watchpack/blob/a54bcdb95759558ca5a9fc2819c4d71b771c162f/lib/DirectoryWatcher.js#L79), or specifying a poll interval in milliseconds:
>>>>>>> 39f5e66582331e4b289cdca7c4b051b25deb7829

**webpack.config.js**

Expand Down
21 changes: 21 additions & 0 deletions src/content/guides/asset-modules.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -476,3 +476,24 @@ module: {
]
},
```

## Disable emitting assets

For use cases like Server side rendering, you might want to disable emitting assets, which is feasible with [`emit`](/configuration/module/#rulegeneratoremit) option under `Rule.generator`:

```js
module.exports = {
// …
module: {
rules: [
{
test: /\.png$/i,
type: 'asset/resource',
generator: {
emit: false,
},
},
],
},
};
```
Loading