Skip to content

update master #404

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

Merged
merged 50 commits into from
Nov 12, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
f2a258a
update /content/loaders & /content/plugins
dear-lizhihua Sep 3, 2017
a5725bb
Merge remote-tracking branch 'upstream/translation' into translation
dear-lizhihua Sep 3, 2017
248be26
update /content/loaders & /content/plugins
dear-lizhihua Sep 19, 2017
36c53b8
Merge remote-tracking branch 'upstream/translation' into translation
dear-lizhihua Sep 19, 2017
25a3d6d
Merge branch 'master' into cn
dear-lizhihua Oct 10, 2017
14bff9f
update /content/loaders & /content/plugins
dear-lizhihua Oct 10, 2017
debfddd
Merge remote-tracking branch 'upstream/cn' into cn
dear-lizhihua Oct 10, 2017
57fb4d4
update contributors
dear-lizhihua Oct 10, 2017
99bf48d
Merge branch 'master' into translation
dear-lizhihua Oct 10, 2017
7fcd796
Merge remote-tracking branch 'upstream/translation' into translation
dear-lizhihua Oct 11, 2017
78e3cee
update /content/loaders & /content/plugins
dear-lizhihua Oct 15, 2017
8a1b2c9
Merge branch 'master' into translation
dear-lizhihua Oct 15, 2017
34575cd
Merge remote-tracking branch 'upstream/translation' into translation
dear-lizhihua Oct 15, 2017
3251e8a
Merge remote-tracking branch 'upstream/cn' into cn
dear-lizhihua Oct 15, 2017
7396c0d
Merge branch 'master' into cn
dear-lizhihua Oct 15, 2017
c0dc1be
fix LinkDropdown
dear-lizhihua Oct 15, 2017
4809e4a
Merge branch 'translation' into cn
dear-lizhihua Oct 15, 2017
178eeeb
修复 npm 命令错误导致编译不成功的问题
dear-lizhihua Oct 17, 2017
8ec33ad
update /content/loaders & /content/plugins
dear-lizhihua Oct 17, 2017
cc7b5e1
Merge remote-tracking branch 'upstream/translation' into translation
dear-lizhihua Oct 17, 2017
93ebe40
Merge remote-tracking branch 'upstream/cn' into cn
dear-lizhihua Oct 29, 2017
1ca293a
update /content/loaders & /content/plugins
dear-lizhihua Oct 30, 2017
a132154
Merge branch 'master' into translation
dear-lizhihua Oct 30, 2017
9fbf758
Merge remote-tracking branch 'upstream/translation' into translation
dear-lizhihua Oct 30, 2017
a40704a
update /content/loaders & /content/plugins
dear-lizhihua Nov 1, 2017
53d47d1
Merge remote-tracking branch 'upstream/translation' into translation
dear-lizhihua Nov 1, 2017
68c4bdd
Merge remote-tracking branch 'upstream/cn' into cn
dear-lizhihua Nov 1, 2017
d622470
docs(plugins): fix typo in module-concatenation-plugin.md (#1683)
mattdsteele Nov 1, 2017
52eb2a4
docs(concepts): simplify the introduction (#1673)
TheDutchCoder Nov 1, 2017
6e8d65d
docs(plugins): add “scope hoisting” intro in module-concatenation-plu…
iamakulov Nov 3, 2017
66443e6
docs(api): fix some method signatures in loaders.md (#1685)
aparajita Nov 3, 2017
b13613e
update /content/loaders & /content/plugins
Nov 4, 2017
0e407de
Merge remote-tracking branch 'upstream/translation' into translation
Nov 4, 2017
d6295cc
Merge remote-tracking branch 'upstream/master'
Nov 4, 2017
955b221
docs(guides): consistent quoute use in typescript.md (#1687)
ulrikstrid Nov 5, 2017
ac739ee
docs(api/guides): document new --concatenate-modules flag (#1686)
iamakulov Nov 5, 2017
6d30cac
docs(guides): fix issues with examples in shimming.md (#1680)
svyandun Nov 5, 2017
ccac872
docs(guides): add middleware tip to the hmr guide
skipjack Nov 5, 2017
5dcd8ac
Merge remote-tracking branch 'upstream/cn' into cn
dear-lizhihua Nov 5, 2017
0f539cb
Merge remote-tracking branch 'upstream/master'
dear-lizhihua Nov 5, 2017
c71abf9
Merge remote-tracking branch 'upstream/cn' into cn
dear-lizhihua Nov 5, 2017
c9cdb7e
Revert "A new --concatenate-modules flag" (#1692)
skipjack Nov 5, 2017
ebd64c9
update master
dear-lizhihua Nov 6, 2017
796d087
Merge remote-tracking branch 'upstream/master'
dear-lizhihua Nov 6, 2017
4a2422b
Merge branch 'master' into cn
dear-lizhihua Nov 6, 2017
fe130ff
update master
dear-lizhihua Nov 6, 2017
19fc4f6
update /content/loaders & /content/plugins
dear-lizhihua Nov 7, 2017
b9d59a4
Merge remote-tracking branch 'upstream/translation' into translation
dear-lizhihua Nov 7, 2017
38fc0d4
Merge branch 'translation' into cn
dear-lizhihua Nov 7, 2017
63574ba
fix bugs
dear-lizhihua Nov 12, 2017
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: 0 additions & 1 deletion src/content/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ webpack.js index=./src/index.js index2=./src/index2.js --output-path='./dist' --
`--optimize-max-chunks` | 限制 chunk 的数量 | [LimitChunkCountPlugin](/plugins/limit-chunk-count-plugin)
`--optimize-min-chunk-size` | 限制 chunk 的最小体积 | [MinChunkSizePlugin](/plugins/min-chunk-size-plugin)
`--optimize-minimize` | 压缩混淆 javascript,并且把 loader 设置为 minimizing | [UglifyJsPlugin](/plugins/uglifyjs-webpack-plugin/) & [LoaderOptionsPlugin](/plugins/loader-options-plugin/)
`--concatenate-modules` | 连结 ES 模块,尽可能移除模块包装容器(module wrappers) | [ModuleConcatenationPlugin](/plugins/module-concatenation-plugin/)


### Resolve 配置
Expand Down
44 changes: 2 additions & 42 deletions src/content/guides/production.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ contributors:
- xgqfrms
- kelset
- xgirma
- iamakulov
---

在本指南中,我们将深入一些最佳实践,并且使用工具,将网站或应用程序构建到生产环境中。
Expand Down Expand Up @@ -200,8 +199,7 @@ __webpack.prod.js__
plugins: [
new UglifyJSPlugin({
sourceMap: true
- })
+ }),
}),
+ new webpack.DefinePlugin({
+ 'process.env': {
+ 'NODE_ENV': JSON.stringify('production')
Expand Down Expand Up @@ -238,48 +236,10 @@ __src/index.js__
document.body.appendChild(component());
```

## Module Concatenation

By default, webpack wraps each module into a function. Wrapping helps to isolate them but brings additional overhead. You can try reducing this overhead by enabling the [`ModuleConcatenationPlugin`](/plugins/module-concatenation-plugin), which, where possible, merges multiple modules in a single module wrapper:

__webpack.prod.js__

```diff
const webpack = require('webpack');
const merge = require('webpack-merge');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const common = require('./webpack.common.js');

module.exports = merge(common, {
devtool: 'cheap-module-source-map',
plugins: [
new UglifyJSPlugin({
sourceMap: true
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
- })
+ }),
+ new webpack.optimize.ModuleConcatenationPlugin()
]
})
```

Read more about module concatenation [in the plugin docs](/plugins/module-concatenation-plugin).


## CLI 替代选项


以上描述也可以通过命令行实现:

- `--optimize-minimize` 标记将在后台引用 `UglifyJSPlugin`;
- `--define process.env.NODE_ENV="'production'"` 将复制上面的 `DefinePlugin` 实例;
- `--concatenate-modules` 将启用 `ModuleConcatenationPlugin`.

并且,`webpack -p` 将自动地调用上述这些标记,从而调用需要引入的插件。
以上描述也可以通过命令行实现。例如,`--optimize-minimize` 标记将在后台引用 `UglifyJSPlugin`。和以上描述的 `DefinePlugin` 实例相同,`--define process.env.NODE_ENV="'production'"` 也会做同样的事情。并且,`webpack -p` 将自动地调用上述这些标记,从而调用需要引入的插件。

这些简便方式虽然都很不错,但是我们通常建议只使用配置方式,因为在这两种场景中下,配置方式能够更好地帮助你了解自己正在做的事情。配置方式还可以让你更方便地控制这两个插件中的其他选项。

Expand Down