Skip to content

Commit

Permalink
Split bundles.
Browse files Browse the repository at this point in the history
  • Loading branch information
xeodou committed Jun 28, 2016
1 parent 7e5961c commit ed55c99
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ node_modules
*.map
.DS_Store
build/CNAME
ningjs.min.js*
ningjs.min.*
vendor.min.js
index.html
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"url": "git+https://github.com/jsconfcn/ningjs.git"
},
"keywords": [
"js"
"JSConf China",
"jsconfcn",
"NingJS"
],
"author": "Wiredcraft",
"license": "MIT",
Expand All @@ -30,6 +32,7 @@
"css-loader": "^0.18.0",
"eslint-plugin-react": "^3.11.1",
"gh-pages": "^0.11.0",
"html-webpack-plugin": "^2.21.0",
"i18n-webpack-plugin": "^0.2.7",
"json-loader": "^0.5.4",
"node-bourbon": "^4.2.3",
Expand All @@ -40,13 +43,10 @@
"webpack-dev-server": "^1.14.1"
},
"dependencies": {
"d3": "^3.5.16",
"html-webpack-plugin": "^2.21.0",
"lodash": "^4.6.1",
"react": "^0.14.7",
"react-dom": "^0.14.7",
"react-router": "^2.0.1",
"topojson": "^1.6.24"
"react-router": "^2.0.1"
},
"homepage": "https://github.com/jsconfcn/ningjs#readme"
}
12 changes: 8 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
const bourbon = require('node-bourbon').includePaths;
const webpack = require('webpack')
const bourbon = require('node-bourbon').includePaths
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
entry: ['./src/app.js'],
entry: {
app: './src/app.js',
vendor: ['react', 'lodash', 'react', 'react-dom', 'react-router']
},
output: {
path: __dirname + '/build',
filename: 'ningjs.min.js'
filename: 'ningjs.min.[hash].js'
},
resolve: {
modulesDirectories: [
Expand Down Expand Up @@ -46,8 +50,8 @@ module.exports = {
}, ]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.min.js'),
new HtmlWebpackPlugin({
hash: true,
filename: 'index.html',
template: 'src/index.template.html'
})
Expand Down
9 changes: 6 additions & 3 deletions webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
devtool: 'cheap-module-source-map',
entry: ['./src/app.js'],
entry: {
app: './src/app.js',
vendor: ['react', 'lodash', 'react', 'react-dom', 'react-router']
},
output: {
path: __dirname + '/build',
filename: 'ningjs.min.js'
filename: 'ningjs.min.[hash].js'
},
resolve: {
modulesDirectories: [
Expand Down Expand Up @@ -48,6 +51,7 @@ module.exports = {
}, ]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.min.js'),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {
Expand All @@ -62,7 +66,6 @@ module.exports = {
}
}),
new HtmlWebpackPlugin({
hash: true,
filename: 'index.html',
template: 'src/index.template.html'
})
Expand Down

0 comments on commit ed55c99

Please sign in to comment.