-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.babel.js
More file actions
70 lines (66 loc) · 1.53 KB
/
Copy pathwebpack.config.babel.js
File metadata and controls
70 lines (66 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import path from 'path';
import util from 'util';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import webpack from 'webpack';
// The full paths to our various directories
const PATHS = {};
['lib', 'build'].forEach((pathName) => {
PATHS[pathName] = path.join(__dirname, pathName);
});
const uiVendorEntries = [
'react',
'react-dom',
];
const dataVendorEntries = [
'immutable',
'redux',
'react-redux'
]
module.exports = {
entry:
{
ui_module: uiVendorEntries,
data_module: dataVendorEntries,
app: path.join(PATHS.lib, 'index.js')
},
resolve: {
extensions: ['.js', '.jsx']
},
output:
{
path: PATHS.build,
filename: '[name].[hash].js',
chunkFilename: '[name].[chunkhash].js',
publicPath: ''
},
module:
{
rules:
[ {
test: /\.jsx?$/,
use: [ {
loader: 'babel-loader', options: {
cacheDirectory: true
}
} ],
include: PATHS.lib
}],
},
plugins:
[
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new HtmlWebpackPlugin({
title: 'Chunk loading demo'
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'commons',
chunks: ['data_module', 'ui_module', 'app'],
minChunks: 2
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest'
})
]
};