Skip to content

Commit 5b99517

Browse files
committed
docs(en): merge all conflicts
1 parent fd7828e commit 5b99517

File tree

10 files changed

+61
-289
lines changed

10 files changed

+61
-289
lines changed

package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,11 @@
139139
"style-loader": "^3.3.1",
140140
"tailwindcss": "^3.1.8",
141141
"tap-spot": "^1.1.2",
142-
<<<<<<< HEAD
143142
"textlint": "^11.8.2",
144143
"textlint-rule-heading": "^1.0.10",
145-
"unist-util-visit": "^4.1.0",
146-
"webpack": "^5.73.0",
147-
"webpack-bundle-analyzer": "^4.5.0",
148-
=======
149144
"unist-util-visit": "^4.1.1",
150145
"webpack": "^5.74.0",
151146
"webpack-bundle-analyzer": "^4.6.1",
152-
>>>>>>> 73993d98f27c3809f16de688fb7220912ea36505
153147
"webpack-cli": "^4.10.0",
154148
"webpack-dev-server": "^4.10.1",
155149
"webpack-merge": "^5.8.0",

src/content/api/plugins.mdx

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ contributors:
99
- byzyk
1010
- EugeneHlushko
1111
- wizardofhogwarts
12-
<<<<<<< HEAD
12+
- snitin315
1313
translators:
1414
- chenzesam
1515
- QC-L
16-
=======
17-
- snitin315
18-
>>>>>>> 73993d98f27c3809f16de688fb7220912ea36505
1916
---
2017

2118
插件是 webpack 生态的关键部分,
@@ -94,24 +91,11 @@ compiler.hooks.run.tapPromise(
9491

9592
## 自定义钩子 $#custom-hooks$
9693

97-
<<<<<<< HEAD
98-
为了便于其他插件的编译过程中可以 `tap` 到,则需要创建一个新的 hook,
99-
我们只需要简单的从 `tapable` `require` 所需的 hook 类,并创建:
100-
=======
101-
In order to offer a custom hook to the compilation for other plugins to `tap` into,
102-
you need to do the following:
103-
>>>>>>> 73993d98f27c3809f16de688fb7220912ea36505
94+
为了便于其他插件的编译过程中可以 `tap` 到,
95+
你可以这样做:
10496

10597
1. Create a module-scope `WeakMap` for compilation hooks:
10698

107-
<<<<<<< HEAD
108-
if (compiler.hooks.myCustomHook) throw new Error('已存在该钩子');
109-
compiler.hooks.myCustomHook = new SyncHook(['a', 'b', 'c']);
110-
111-
// 在你想要触发钩子的位置/时机下调用……
112-
compiler.hooks.myCustomHook.call(a, b, c);
113-
```
114-
=======
11599
```ts
116100
const compilationHooks = new WeakMap<Compilation, MyHooks>();
117101

@@ -120,7 +104,7 @@ compiler.hooks.myCustomHook.call(a, b, c);
120104
}
121105
```
122106

123-
2. Create a static method on your plugin:
107+
2. 在插件中创建一个静态方法:
124108

125109
```ts
126110
static getCompilationHooks(compilation: Compilation) : MyHooks {
@@ -134,15 +118,15 @@ compiler.hooks.myCustomHook.call(a, b, c);
134118
}
135119
```
136120

137-
3. Call hooks like below in your plugin:
121+
3. 像下面这样在你的插件中调用钩子函数:
138122

139123
```ts
140124
const hooks = MyPlugin.getCompilationHooks(compilation);
141125

142126
hooks.custom.call(1, 'hello');
143127
```
144128

145-
4. Other plugins can access your custom hooks too:
129+
4. 其他插件也可以访问你的自定义钩子函数:
146130

147131
```ts
148132
import MyPlugin from 'my-plugin';
@@ -153,7 +137,6 @@ compiler.hooks.myCustomHook.call(a, b, c);
153137
// magic
154138
});
155139
```
156-
>>>>>>> 73993d98f27c3809f16de688fb7220912ea36505
157140

158141
再次声明,
159142
查看 `tapable` [文档](https://github.com/webpack/tapable) 来了解更多不同的钩子类(hook class),以及它们是如何工作的。

src/content/blog/2020-10-10-webpack-5-release.mdx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,7 @@ export function test() {
365365

366366
当设置`"sideEffects": false`时,可以省略更多的模块。在这个例子中,当 `test` 导出未被使用时,`./something` 将被省略。
367367

368-
<<<<<<< HEAD
369-
要获得未使用的导出信息,需要使用 `optimization.unusedExports`。要删除无副作用的模块,需要使用`optimization.sideEffects`。
370-
=======
371-
To get the information about unused exports `optimization.usedExports` is required. To remove side-effect-free modules `optimization.sideEffects` is required.
372-
>>>>>>> 73993d98f27c3809f16de688fb7220912ea36505
368+
要获得未使用的导出信息,需要使用 `optimization.usedExports`。要删除无副作用的模块,需要使用`optimization.sideEffects`
373369

374370
可以分析以下标记。
375371

src/content/configuration/dev-server.mdx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,7 @@ W> 请注意,当[导出多个配置对象](/configuration/configuration-types/
7575

7676
T> 如果你碰到了问题,请将路由导航至 `/webpack-dev-server` 将会为你展示服务文件的位置。例如: `http://localhost:9000/webpack-dev-server`
7777

78-
<<<<<<< HEAD
79-
T> 如果你需要要手动重新编译 `bundle`,将路由导航至 `/invalidate` 使当前编译的 `bundle` [无效](/api/node/#invalidate-watching),并通过 [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware#invalidate) 为你重新编译。根据你的配置,URL 可能看起来像 `http://localhost:9000/invalidate`
80-
=======
81-
T> If you want to manually recompile the bundle, navigating to the `/webpack-dev-server/invalidate` route will [invalidate](/api/node/#invalidate-watching) the current compilation of the bundle and recompile it for you via [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware#invalidate). Depending on your configuration, the URL may look like `http://localhost:9000/webpack-dev-server/invalidate`.
82-
>>>>>>> 73993d98f27c3809f16de688fb7220912ea36505
78+
T> 如果你需要要手动重新编译 `bundle`,将路由导航至 `/webpack-dev-server/invalidate` 使当前编译的 `bundle` [无效](/api/node/#invalidate-watching),并通过 [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware#invalidate) 为你重新编译。根据你的配置,URL 可能看起来像 `http://localhost:9000/webpack-dev-server/invalidate`
8379

8480
T> 当启动本地服务的时候 HTML 模板是必须提供的,通常是 `index.html`。确保将脚本引用添加到 HTML 中,webpack-dev-server 不会自动注入它们。
8581

@@ -1588,13 +1584,8 @@ module.exports = {
15881584
// 如果你想在所有其他中间件之前运行一个中间件或者当你从 `onBeforeSetupMiddleware` 配置项迁移时,
15891585
// 可以使用 `unshift` 方法
15901586
middlewares.unshift({
1591-
<<<<<<< HEAD
1592-
name: 'fist-in-array',
1593-
// `path` 是可选的
1594-
=======
15951587
name: 'first-in-array',
1596-
// `path` is optional
1597-
>>>>>>> 73993d98f27c3809f16de688fb7220912ea36505
1588+
// `path` 是可选的
15981589
path: '/foo/path',
15991590
middleware: (req, res) => {
16001591
res.send('Foo!');

0 commit comments

Comments
 (0)