Skip to content

Commit 363b56f

Browse files
committed
Split app and vendors
1 parent 17a5e8c commit 363b56f

File tree

4 files changed

+42
-30
lines changed

4 files changed

+42
-30
lines changed

todomvc/build/bundle.js

Lines changed: 1 addition & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

todomvc/build/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
</head>
1010
<body>
1111
<div id="app"></div>
12+
<!-- See webpack.config.js -->
13+
<script type="text/javascript" src="vendors.js"></script>
1214
<script type="text/javascript" src="bundle.js"></script>
1315
</body>
1416
</html>

todomvc/build/vendors.js

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

todomvc/webpack.config.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@ var webpack = require('webpack');
55
var ExtractTextPlugin = require("extract-text-webpack-plugin");
66

77
var config = {
8-
entry: getEntrySources([
9-
path.resolve(__dirname, 'app/index.js')
10-
]),
8+
entry: {
9+
app: getEntrySources([
10+
path.resolve(__dirname, 'app/index.js')
11+
]),
12+
vendors: [
13+
'react',
14+
'react-dom',
15+
'react-redux',
16+
'redux',
17+
'classnames'
18+
]
19+
},
1120
output: {
1221
path: path.resolve(__dirname, 'build'),
1322
filename: 'bundle.js'
@@ -30,7 +39,8 @@ var config = {
3039
plugins: [
3140
new ExtractTextPlugin('style.css', {
3241
allChunks: true
33-
})
42+
}),
43+
new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js')
3444
]
3545
}
3646

0 commit comments

Comments
 (0)