You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* update /content/loaders & /content/plugins
* update /content/loaders & /content/plugins
* update /content/loaders & /content/plugins
* update contributors
* update /content/loaders & /content/plugins
* fix LinkDropdown
* 修复 npm 命令错误导致编译不成功的问题
* update /content/loaders & /content/plugins
* update /content/loaders & /content/plugins
* update /content/loaders & /content/plugins
* docs(plugins): fix typo in module-concatenation-plugin.md (#1683)
* docs(concepts): simplify the introduction (#1673)
Make the `index` page more beginner friendly with less technical
lingo and complex details.
Resolves#1416
* docs(plugins): add “scope hoisting” intro in module-concatenation-plugin (#1684)
This adds a link between “concatenation behavior” and “scope hoisting”. Without this,
a new person might be confused what exactly “scope hoisting” is (because it appears
without any visible connection to the previous content).
* docs(api): fix some method signatures in loaders.md (#1685)
In actual fact the parameters passed to `emitWarning` / `emitError` must
be an instance of Error.
* update /content/loaders & /content/plugins
* docs(guides): consistent quoute use in typescript.md (#1687)
* docs(api/guides): document new --concatenate-modules flag (#1686)
Document the new `--concatenate-modules` flag in both the CLI documentation
and production guide. Add section on the `ModuleConcatenationPlugin` in the
production guide (as we include this plugin under `-p`, it also makes sense to
mention it in this guide.
* docs(guides): fix issues with examples in shimming.md (#1680)
Rename plugin identifier and require webpack when it is used in the
configuration examples.
* docs(guides): add middleware tip to the hmr guide
Resolves#1682
* Revert "A new --concatenate-modules flag" (#1692)
* update master
* update /content/loaders & /content/plugins
* docs(concepts): fix grammar in output.md (#1694)
* docs(contribute): update writing-a-loader (#1691)
Use normal function instead of arrow function to fix scope in loader
example.
* docs(plugins): add external example in SourceMapDevToolPlugin (#1676)
Demonstrate how one might use the plugin to host source maps externally.
* docs(config): update dev-server open option (#1693)
State the ability to open in specific browser.
* fix bugs
* update /content/loaders & /content/plugins
* docs(api): improve formatting and grammar in loaders.md
* docs(api): clarify fourth parameter of `this.callback` in loaders.md
Add some lead in descriptions to the `Examples` section and clarify that meta
data can be passed along via the fourth parameter to `this.callback` and accepted
as the third parameter to a loader function.
Resolves#1607
* docs(api): populate missing link in loaders.md
* docs(plugins): correct example in html-webpack-plugin (#1698)
* docs(guides): update an example in production.md (#1696)
Switch to shortened form when using the `DefinePlugin` to define the
`process.env.NODE_ENV` value. This avoids a bug which is mentioned
in the plugin's documentation:
https://webpack.js.org/plugins/define-plugin/#feature-flags
* fix(markdown): fix overflowing inline code (#1701)
Change the css to fix the text inside code tag which was overflowing
the parent div.
* docs(concepts): update concepts wording (#1702)
Add "static" to "module bundler". Some feedback here was given to me
on twitter to make sure we are clear with what these terms mean.
* update /content/loaders & /content/plugins
* docs(config): fix dead link to webpack-dev-server example (#1704)
* docs(concepts): use fragment links in usage instructions (#1705)
This is just a quality of life adjustment that updates the list of ways to
use loaders with fragment links to the relevant section in the docs. In
their current state, the section feels like a dead end, abruptly cutting off
with three bullet points and no examples. While one can read on and
figure it out, there is a break in focus that is quite distracting.
* docs(guides): add windows usage tip in getting-started (#1671)
* doc(guides): fix grammatical error in build-performance (#1709)
Change "less" to "fewer".
* docs(guides): correct two small typos
* docs(api): remove inadvertent double verb (#1714)
* docs(contribute): fix grammar in writing-a-plugin (#1715)
* docs(config): add semicolon for consistency (#1716)
The final code block was missing a semicolon from the end of the
first line; added it in to match the other require statements.
* docs(contributing): add note about debian OS (#1721)
Related issue: #1718
* docs(guides): add output example to shimming doc (#1720)
* docs(plugins): use `.includes` over `.indexOf` (#1719)
Really minor but I think `.includes` is more readable to the unfamiliar
with javascript.
* docs(guides): use `npx` in getting-started (#1708)
Keep the mention the webpack binary's path but use the `npx` utility
now that it ships with Node. Fix some punctuation and grammar. Clarify
why npm scripts are still useful even over `npx`.
* update /src/content/loaders & /src/content/plugins
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,8 @@ See the `package.json` for the full list of `scripts`.
30
30
31
31
> Note that a __Python version between v2.5.0 and 3.0.0__ is required for the [proselint][12] dependency.
32
32
33
+
> On Debian and Ubuntu operating systems you may have to use `node >= 7.0.0` to avoid build errors with `node-sass`. Please note that we don't officially support building on these systems.
Copy file name to clipboardExpand all lines: src/content/api/loaders.md
+60-50Lines changed: 60 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,49 +15,56 @@ contributors:
15
15
16
16
## 示例
17
17
18
+
The following sections provide some basic examples of the different types of loaders. Note that the `map` and `meta` parameters are optional, see [`this.callback`](/api/loaders#this-callback) below.
19
+
18
20
### 同步 loader
19
21
20
-
**sync-loader.js**
22
+
Either `return` or `this.callback` can be used to return the transformed `content` synchronously:
21
23
22
-
```javascript
23
-
module.exports=function(content) {
24
+
__sync-loader.js__
25
+
26
+
```js
27
+
module.exports=function(content, map, meta) {
24
28
returnsomeSyncOperation(content);
25
29
};
26
30
```
27
31
28
-
**sync-loader-with-multiple-results.js**
32
+
The `this.callback` method is more flexible as it allows multiple arguments to be passed as opposed to just the `content`.
4. 可选的:The fourth option, ignored by webpack, can be anything (e.g. some meta data).
167
+
168
+
T> It can be useful to pass an abstract syntax tree (AST), like [`ESTree`](https://github.com/estree/estree), as the fourth argument (`meta`) to speed up the build time if you want to share common ASTs between loaders.
Copy file name to clipboardExpand all lines: src/content/configuration/dev-server.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ Content not from webpack is served from /path/to/dist/
40
40
41
41
这将给出一些背景知识,就能知道服务器的访问位置,并且知道服务已启动。
42
42
43
-
如果你通过 Node.js API 来使用 dev-server, `devServer` 中的选项将被忽略。将选项作为第二个参数传入: `new WebpackDevServer(compiler, {...})`。关于如何通过 Node.js API 使用 webpack-dev-server 的示例,请[查看此处](https://github.com/webpack/webpack-dev-server/blob/master/examples/node-api-simple/server.js)。
43
+
如果你通过 Node.js API 来使用 dev-server, `devServer` 中的选项将被忽略。将选项作为第二个参数传入: `new WebpackDevServer(compiler, {...})`。关于如何通过 Node.js API 使用 webpack-dev-server 的示例,请[查看此处](https://github.com/webpack/webpack-dev-server/tree/master/examples/api/simple)。
44
44
45
45
W> Be aware that when [exporting multiple configurations](/configuration/configuration-types/#exporting-multiple-configurations) only the `devServer` options for the first configuration will be taken into account and used for all the configurations in the array.
46
46
@@ -465,6 +465,12 @@ Usage via the CLI
465
465
webpack-dev-server --open
466
466
```
467
467
468
+
If no browser is provided (as shown above), your default browser will be used. To specify a different browser, just pass its name:
Here each of the plugins are called one after the other with the args from the return value of the previous plugin. The plugin must take into consider the order of its execution.
181
+
Here each of the plugins are called one after the other with the args from the return value of the previous plugin. The plugin must take the order of its execution into account.
182
182
It must accept arguments from the previous plugin that was executed. The value for the first plugin is `init`. This pattern is used in the Tapable instances which are related to the `webpack` templates like `ModuleTemplate`, `ChunkTemplate` etc.
183
183
184
184
-__asynchronous__ When all the plugins are applied asynchronously using
0 commit comments