Skip to content

Commit d872c7b

Browse files
committed
docs(en): fix conflicts
1 parent bb155ac commit d872c7b

File tree

12 files changed

+34
-301
lines changed

12 files changed

+34
-301
lines changed

package.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,8 @@
100100
"eslint-plugin-react": "^7.29.4",
101101
"eslint-plugin-react-hooks": "^4.4.0",
102102
"front-matter": "^4.0.2",
103-
<<<<<<< HEAD
104-
"github-slugger": "^1.3.0",
105-
"html-loader": "^2.1.2",
106-
=======
107103
"github-slugger": "^1.4.0",
108-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
104+
"html-loader": "^2.1.2",
109105
"html-webpack-plugin": "^5.5.0",
110106
"http-server": "^14.1.0",
111107
"husky": "^7.0.4",
@@ -114,15 +110,9 @@
114110
"lint-staged": "^12.3.7",
115111
"lodash": "^4.17.21",
116112
"markdownlint": "^0.25.1",
117-
<<<<<<< HEAD
118-
"markdownlint-cli": "^0.31.0",
119-
"mdast-util-to-string": "^1.1.0",
120-
"mini-css-extract-plugin": "^2.5.3",
121-
=======
122113
"markdownlint-cli": "^0.31.1",
123114
"mdast-util-to-string": "^3.1.0",
124115
"mini-css-extract-plugin": "^2.6.0",
125-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
126116
"mkdirp": "^1.0.4",
127117
"modularscale-sass": "^3.0.3",
128118
"node-fetch": "^3.2.3",

src/components/Site/Site.jsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,10 @@ function Site(props) {
268268
)
269269
),
270270
},
271-
<<<<<<< HEAD
272271
{ content: '参与贡献', url: '/contribute/' },
273-
{ content: '投票', url: 'https://v4.webpack.docschina.org/vote/' },
272+
{ content: '投票', url: '/vote/' },
274273
{ content: '博客', url: '/blog/' },
275274
{ content: '印记中文', url: 'https://docschina.org' },
276-
=======
277-
{ content: 'Contribute', url: '/contribute/' },
278-
{ content: 'Vote', url: '/vote/' },
279-
{ content: 'Blog', url: '/blog/' },
280-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
281275
]}
282276
/>
283277
</div>

src/content/api/cli.mdx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,7 @@ npx webpack init ./my-app --force --template=default
101101

102102
`boolean`
103103

104-
<<<<<<< HEAD
105-
生成项目时不启用选项模式。当为 `true` 时,所有命令行选项使用默认值。
106-
=======
107-
To generate a project without questions. When enabled, the default answer for each question will be used.
108-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
104+
不输入配置项就生成一个项目。该配置启用时所有命令行配置项将使用默认值。
109105

110106
T> 点击 [这里](https://github.com/webpack/webpack-cli/blob/master/packages/generators/INIT.md) 获取 `webpack init` 命令的完整文档。
111107

@@ -585,19 +581,11 @@ T> 请查阅 [environment 变量指南](/guides/environment-variables/)了解更
585581

586582
除了上面所说的自定义 `env` 变量,在你的 webpack 配置中也使用了一些 `env` 内置变量:
587583

588-
<<<<<<< HEAD
589584
| 变量名 | 描述 |
590585
| --------------- | --------------------------------------------- |
591-
| `WEBPACK_SERVE` | 如果使用了 `serve\|s`,则为 `true`。 |
586+
| `WEBPACK_SERVE` | 如果使用了 `serve\|server\|s`,则为 `true`|
592587
| `WEBPACK_BUILD` | 如果使用了 `build\|bundle\|b`,则为 `true`|
593588
| `WEBPACK_WATCH` | 如果使用了 `--watch\|watch\|w`,则为 `true`|
594-
=======
595-
| Environment Variable | Description |
596-
| -------------------- | -------------------------------------------- |
597-
| `WEBPACK_SERVE` | `true` if `serve\|server\|s` is being used. |
598-
| `WEBPACK_BUILD` | `true` if `build\|bundle\|b` is being used. |
599-
| `WEBPACK_WATCH` | `true` if `--watch\|watch\|w` is being used. |
600-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
601589

602590
请注意你不能在 bundle 代码中使用这些内置环境变量。
603591

src/content/api/compilation-object.mdx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,7 @@ Compilation 对象有很多可用的方法和钩子。在此页面,我们将
229229
- `block` - `Chunk` 的块连接。
230230
- `chunk` - 从依赖中删除的块。
231231

232-
<<<<<<< HEAD
233-
### sortItemsWithModuleIds $#sortitemswithmoduleids$
234-
235-
`function`
236-
237-
### sortItemsWithChunkIds $#sortitemswithchunkids$
238-
=======
239-
### sortItemsWithChunkIds
240-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
232+
### sortItemsWithChunkIds $#sortitemswithmoduleids$
241233

242234
`function`
243235

src/content/api/module-variables.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,11 @@ console.log(import.meta.webpack); // output `5` for webpack 5
109109
110110
webpack 特定。[`module.hot`](#modulehot-webpack-specific) 的一个别名,[strict ESM](/guides/ecma-script-modules/#flagging-modules-as-esm) 中可以使用 `import.meta.webpackHot` 但是不能使用 `module.hot`
111111
112-
<<<<<<< HEAD
113-
## \_\_filename (NodeJS) $#__filename-nodejs$
114-
=======
115112
## import.meta.webpackContext
116113
117-
Returns the same value as `require.context` but only for `javascript/auto` and `javascript/esm`.
114+
返回与 `require.context` 一样的值,但是仅用于 `javascript/auto` `javascript/esm`
118115
119-
- Type:
116+
- 类型:
120117
121118
```ts
122119
(
@@ -135,8 +132,8 @@ Returns the same value as `require.context` but only for `javascript/auto` and `
135132
) => webpack.Context;
136133
```
137134
138-
- Available: 5.70.0+
139-
- Example:
135+
- 可用版本:5.70.0+
136+
- 示例:
140137
```js
141138
const contextRequire = import.meta.webpackContext('.', {
142139
recursive: false,
@@ -147,7 +144,6 @@ Returns the same value as `require.context` but only for `javascript/auto` and `
147144
```
148145
149146
## \_\_filename (NodeJS)
150-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
151147
152148
取决于 `node.__filename` 配置选项:
153149

src/content/configuration/dev-server.mdx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,11 +1277,7 @@ npx webpack serve --port auto
12771277

12781278
当拥有单独的 API 后端开发服务器并且希望在同一域上发送 API 请求时,代理某些 URL 可能会很有用。
12791279

1280-
<<<<<<< HEAD
1281-
开发服务器使用功能强大的 [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) 软件包。 查看其 [documentation](https://github.com/chimurai/http-proxy-middleware#options) 了解更多高级用法。 请注意,`http-proxy-middleware` 的某些功能不需要`target`键,例如 它的 `router` 功能,但是仍然需要在此处的配置中包含`target`,否则`webpack-dev-server` 不会将其传递给 `http-proxy-middleware`)。
1282-
=======
1283-
The dev-server makes use of the powerful [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) package. Check out its [documentation](https://github.com/chimurai/http-proxy-middleware#options) for more advanced usages. Note that some of `http-proxy-middleware`'s features do not require a `target` key, e.g. its `router` feature, but you will still need to include a `target` key in your configuration here, otherwise `webpack-dev-server` won't pass it along to `http-proxy-middleware`.
1284-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
1280+
开发服务器使用功能强大的 [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) 软件包。 查看其 [documentation](https://github.com/chimurai/http-proxy-middleware#options) 了解更多高级用法。 请注意,`http-proxy-middleware` 的某些功能不需要`target`键,例如 它的 `router` 功能,但是仍然需要在此处的配置中包含`target`,否则`webpack-dev-server` 不会将其传递给 `http-proxy-middleware`
12851281

12861282
使用后端在 `localhost:3000` 上,可以使用它来启用代理:
12871283

src/content/configuration/experiments.mdx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,45 +157,41 @@ Note that you should commit files under `experiments.buildHttp.cacheLocation` in
157157

158158
Freeze the remote resources and lockfile. Any modification to the lockfile or resource contents will result in an error.
159159

160-
- Type: `boolean`
160+
- 类型:`boolean`
161161

162162
#### experiments.buildHttp.lockfileLocation $#experimentsbuildhttplockfilelocation$
163163

164164
Define the location to store the lockfile.
165165

166-
- Type: `string`
166+
- 类型:`string`
167167

168168
By default webpack would generate a `<compiler-name.>webpack.lock` file>. Make sure to commit it into a version control system. During the `production` build, webpack will build those modules beginning with `http(s):` protocol from the lockfile and caches under [`experiments.buildHttp.cacheLocation`](#experimentsbuildhttpcachelocation).
169169

170-
<<<<<<< HEAD
171-
#### experiments.buildHttp.upgrade $#experimentsbuildhttpupgrade$
172-
=======
173170
#### experiments.buildHttp.proxy
174171

175-
Specify the proxy server to use for fetching remote resources.
172+
指定用来获取远程资源的代理服务器。
176173

177-
- Type: `string`
174+
- 类型:`string`
178175

179-
By default, Webpack would imply the proxy server to use for fetching remote resources from the `http_proxy` (case insensitive) environment variable. However, you can also specify one through the `proxy` option.
176+
默认情况下,webpack 会让代理服务器使用 `http_proxy`(不区分大小写) 环境变量值获取远程资源。然而,你也可以通过 `proxy` 配置项指定。
180177

181178
#### experiments.buildHttp.upgrade
182-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
183179

184-
Detect changes to remote resources and upgrade them automatically.
180+
检测远程资源的更改并自动升级。
185181

186-
- Type: `boolean`
182+
- 类型:`boolean`
187183

188184
### experiments.css $#experimentscss$
189185

190186
启用原生 CSS 支持。请注意该实验特性仍处于开发状态并且将会在 webpack v6 中默认启用,你可以在 [GitHub](https://github.com/webpack/webpack/issues/14893) 中跟踪进度。
191187

192-
- Type: `boolean`
188+
- 类型:`boolean`
193189

194190
### experiments.cacheUnaffected $#experimentscacheunaffected$
195191

196192
Enable additional in-memory caching of modules which are unchanged and reference only unchanged modules.
197193

198-
- Type: `boolean`
194+
- 类型:`boolean`
199195

200196
Defaults to the value of [`futureDefaults`](#experimentsfuturedefaults).
201197

src/content/configuration/module.mdx

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

209-
<<<<<<< HEAD
210-
#### module.parser.javascript.reexportExportsPresence $#moduleparserjavascriptreexportexportspresence$
211-
=======
212209
#### module.parser.javascript.importMetaContext
213210

214-
Enable/disable evaluating [`import.meta.webpackContext`](/api/module-variables/#importmetawebpackcontext).
211+
启用/禁用 [`import.meta.webpackContext`](/api/module-variables/#importmetawebpackcontext) 分析。
215212

216-
- Type: `boolean`
217-
- Available: 5.70.0+
218-
- Example:
213+
- 类型:`boolean`
214+
- 可用版本:5.70.0+
215+
- 示例:
219216
```js
220217
module.exports = {
221218
module: {
@@ -229,7 +226,6 @@ Enable/disable evaluating [`import.meta.webpackContext`](/api/module-variables/#
229226
```
230227

231228
#### module.parser.javascript.reexportExportsPresence
232-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
233229

234230
指出在 `\"export ... from ...\"` 中无效导出名称的行为。当在 TypeScript 重新导出类型,从 `\"export ... from ...\"` 迁移到 `\"export type ... from ...\"` 时禁用该配置项是有用的。
235231

src/content/configuration/output.mdx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,9 @@ translators:
4242

4343
[`output.filename`](#outputfilename) 相同,不过应用于 [Asset Modules](/guides/asset-modules/)
4444

45-
<<<<<<< HEAD
46-
## output.asyncChunks $#outputasyncchunks$
47-
=======
48-
`[name]`, `[file]`, `[query]`, `[fragment]`, `[base]`, and `[path]` are set to an empty string for the assets built from data URI replacements.
45+
对从数据 URI 替换构建的静态资源,`[name]`, `[file]`, `[query]`, `[fragment]`, `[base]``[path]` 为空字符串。
4946

5047
## output.asyncChunks
51-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
5248

5349
`boolean = true`
5450

@@ -667,13 +663,9 @@ T> 在某些上下文中,属性将使用 JavaScript 代码表达式代替原
667663

668664
当输出为 library 时,尤其是当 `libraryTarget``'umd'`时,此选项将决定使用哪个全局对象来挂载 library。为了使 UMD 构建在浏览器和 Node.js 上均可用,应将 `output.globalObject` 选项设置为 `'this'`。对于类似 web 的目标,默认为 `self`
669665

670-
<<<<<<< HEAD
671-
示例:
672-
=======
673-
The return value of your entry point will be assigned to the global object using the value of `output.library.name`. Depending on the value of the `target` option, the global object could change respectively, e.g., `self`, `global`, or `globalThis`.
666+
入口点的返回值将会使用 `output.library.name` 赋值给全局对象。依赖于 `target` 配置项,全局对象将会发生对应的改变,例如:`self`, `global` 或者 `globalThis`
674667

675-
For example:
676-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
668+
示例:
677669

678670
**webpack.config.js**
679671

src/content/guides/code-splitting.mdx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@ contributors:
3434
- Adarah
3535
- atesgoral
3636
- snitin315
37-
<<<<<<< HEAD
37+
- artem-malko
3838
translators:
3939
- QC-L
4040
- jacob-lcs
4141
- dear-lizhihua
42-
=======
43-
- artem-malko
44-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
4542
related:
4643
- title: webpack 中的 <link rel="prefetch/preload" />
4744
url: https://medium.com/webpack/link-rel-prefetch-preload-in-webpack-51a52358f84c
@@ -433,22 +430,18 @@ import(/* webpackPreload: true */ 'ChartingLibrary');
433430

434431
T> 不正确地使用 `webpackPreload` 会有损性能,请谨慎使用。
435432

436-
<<<<<<< HEAD
437-
## bundle 分析(bundle analysis) $#bundle-analysis$
438-
=======
439-
Sometimes you need to have your own control over preload. For example, preload of any dynamic import can be done via async script. This can be useful in case of streamming server side rendering.
433+
有时你需要自己控制预加载。例如,任何动态导入的预加载都可以通过异步脚本完成。这在流式服务器端渲染的情况下很有用。
440434

441435
```js
442436
const lazyComp = () =>
443437
import('DynamicComponent').catch((error) => {
444-
// Do something with the error.
445-
// For example, we can retry the request in case of any net error
438+
// 在发生错误时做一些处理
439+
// 例如,我们可以在网络错误的情况下重试请求
446440
});
447441
```
442+
如果在 webpack 开始加载该脚本之前脚本加载失败(如果该脚本不在页面上,webpack 只是创建一个 script 标签来加载其代码),则该 catch 处理程序将不会启动,直到 [chunkLoadTimeout](/configuration/output/#outputchunkloadtimeout) 未通过。此行为可能是意料之外的。但这是可以解释的 - webpack 不能抛出任何错误,因为 webpack 不知道那个脚本失败了。Webpack 将在错误发生后立即将 onerror 处理脚本添加到 script 中。
448443

449-
If the script loading will fail before webpack starts loading of that script by itself (webpack just creates a script tag to load its code, if that script is not on a page), that catch handler won't start till [chunkLoadTimeout](/configuration/output/#outputchunkloadtimeout) is not passed. This behavior can be unexpected. But it's explainable webpack can not throw any error, cause webpack doesn't know, that script failed. Webpack will add onerror handler to the script right after the error has happen.
450-
451-
To prevent such problem you can add your own onerror handler, which removes the script in case of any error:
444+
为了避免上述问题,你可以添加自己的 onerror 处理脚本,将会在错误发生时移除该 script。
452445

453446
```html
454447
<script
@@ -458,10 +451,9 @@ To prevent such problem you can add your own onerror handler, which removes the
458451
></script>
459452
```
460453

461-
In that case, errored script will be removed. Webpack will create its own script and any error will be processed without any timeouts.
454+
在这种情况下,错误的 script 将被删除。Webpack 将创建自己的 script,并且任何错误都将被处理而没有任何超时。
462455

463-
## Bundle Analysis
464-
>>>>>>> 2eb6c6adc5157680cd9e38aa7767c3e5fee78e76
456+
## bundle 分析(bundle analysis) $#bundle-analysis$
465457

466458
一旦开始分离代码,一件很有帮助的事情是,分析输出结果来检查模块在何处结束。 [官方分析工具](https://github.com/webpack/analyse) 是一个不错的开始。还有一些其他社区支持的可选项:
467459

0 commit comments

Comments
 (0)