Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c428c4b

Browse files
committed
update webpack-common-chunk
1 parent 616ac6f commit c428c4b

File tree

11 files changed

+50
-19
lines changed

11 files changed

+50
-19
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
# CommonsChunkPlugin
1+
# CommonsChunkPlugin
2+
3+
CommonsChunkPlugin插件会生成公共chunk,这个公共chunk会变成entry chunk,即包含webpack runtime,而且会包含其他公共的模块。
4+
5+
应尽量将长期不变动的类库打包到一个vendor chunk文件中,而且这个文件中不应该包含webpack runtime以及其他公共模块,因为webpack runtime和公共模块的代码都会变化,这会导致vendor chunk缓存失效。

‎tutorials/webpack-common-chunk/example2.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ module.exports = {
1515

1616
// plugins: [
1717
// new webpack.optimize.CommonsChunkPlugin({
18-
// //本例中init.js = webpack runtime + polyfill + utility2
18+
// //init.js = webpack runtime + polyfill + utility2
1919
// name: "init"
2020
// })
2121
// ]
2222

2323
plugins: [
2424
new webpack.optimize.CommonsChunkPlugin({
25-
//本例中init.js = webpack runtime
25+
//init.js = webpack runtime
2626
name: "init",
2727
minChunks: Infinity
2828
})

‎tutorials/webpack-common-chunk/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"reference": [
2222
"https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin",
2323
"http://stackoverflow.com/questions/39548175/can-someone-explain-webpacks-commonschunkplugin",
24+
"http://stackoverflow.com/questions/35908253/webpack-how-to-bundle-entries-to-multiple-common-chunks-with-commonschunkplugin",
2425
"https://webpack.js.org/plugins/commons-chunk-plugin/",
2526
"https://github.com/webpack/webpack/tree/master/examples/common-chunk-and-vendor-chunk",
2627
"https://github.com/webpack/webpack/tree/master/examples/multiple-entry-points-commons-chunk-css-bundle",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "jQuery";

‎tutorials/webpack-common-chunk/src/pageA.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var polyfill = require('./polyfill');
2+
var jQuery = require('./jQuery');
3+
var underscore = require('./underscore');
24
var utility1 = require('./utility1');
35
var utility2 = require('./utility2');
46

‎tutorials/webpack-common-chunk/src/pageB.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var polyfill = require('./polyfill');
2+
var jQuery = require('./jQuery');
3+
var underscore = require('./underscore');
24
var utility2 = require('./utility2');
35
var utility3 = require('./utility3');
46

‎tutorials/webpack-common-chunk/src/pageC.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var polyfill = require('./polyfill');
2+
var jQuery = require('./jQuery');
3+
var underscore = require('./underscore');
24
var utility2 = require('./utility2');
35
var utility3 = require('./utility3');
46

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "underscore";

‎tutorials/webpack-common-chunk/src/vendor1.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎tutorials/webpack-common-chunk/src/vendor2.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /