Put vendor in an own file in production
This commit is contained in:
parent
d32ee5ac36
commit
fb60ba496c
3 changed files with 18 additions and 5 deletions
|
|
@ -13,12 +13,9 @@ module.exports = {
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.jsx']
|
extensions: ['.js', '.jsx']
|
||||||
},
|
},
|
||||||
entry: [
|
|
||||||
path.resolve(__dirname, 'src/index.jsx')
|
|
||||||
],
|
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, 'dist'),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
filename: 'main.js'
|
filename: '[name]-[chunkhash].js'
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
loaders: [
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
const merge = require('webpack-merge');
|
const merge = require('webpack-merge');
|
||||||
|
const path = require('path');
|
||||||
const common = require('./webpack.common.js');
|
const common = require('./webpack.common.js');
|
||||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||||
|
|
||||||
|
|
@ -10,6 +11,9 @@ const extractCSS = ExtractTextPlugin.extract({
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
|
entry: {
|
||||||
|
main: path.resolve(__dirname, 'src/index.jsx')
|
||||||
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
loaders: [
|
||||||
{ test: /\.css$/, use: extractCSS },
|
{ test: /\.css$/, use: extractCSS },
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
const path = require('path');
|
||||||
const merge = require('webpack-merge');
|
const merge = require('webpack-merge');
|
||||||
const common = require('./webpack.common.js');
|
const common = require('./webpack.common.js');
|
||||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||||
|
|
@ -15,6 +16,10 @@ const extractCSS = ExtractTextPlugin.extract({
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
|
entry: {
|
||||||
|
main: path.resolve(__dirname, 'src/index.jsx'),
|
||||||
|
vendor: ['react', 'material-ui', 'mqtt', 'ramda']
|
||||||
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
loaders: [
|
||||||
{ test: /\.css$/, use: extractCSS },
|
{ test: /\.css$/, use: extractCSS },
|
||||||
|
|
@ -28,6 +33,13 @@ module.exports = merge(common, {
|
||||||
'process.env': {
|
'process.env': {
|
||||||
'NODE_ENV': JSON.stringify('production')
|
'NODE_ENV': JSON.stringify('production')
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
|
new webpack.HashedModuleIdsPlugin(),
|
||||||
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
|
name: 'vendor'
|
||||||
|
}),
|
||||||
|
new webpack.optimize.CommonsChunkPlugin({
|
||||||
|
name: 'runtime'
|
||||||
|
}),
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue