/
client.dev.js
85 lines (83 loc) · 2.2 KB
/
client.dev.js
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const path = require('path')
const webpack = require('webpack')
const WriteFilePlugin = require('write-file-webpack-plugin')
const AutoDllPlugin = require('autodll-webpack-plugin')
const ExtractCssChunks = require('extract-css-chunks-webpack-plugin')
module.exports = {
name: 'client',
target: 'web',
// devtool: 'source-map',
devtool: 'eval',
entry: [
'babel-polyfill',
'fetch-everywhere',
'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=false&quiet=false&noInfo=false',
'react-hot-loader/patch',
path.resolve(__dirname, '../src/index.js')
],
output: {
filename: '[name].js',
chunkFilename: '[name].js',
path: path.resolve(__dirname, '../buildClient'),
publicPath: '/static/'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.css$/,
use: ExtractCssChunks.extract({
use: {
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]__[local]--[hash:base64:5]'
}
}
})
}
]
},
resolve: {
extensions: ['.js', '.css']
},
plugins: [
new WriteFilePlugin(), // used so you can see what chunks are produced in dev
new ExtractCssChunks(),
new webpack.optimize.CommonsChunkPlugin({
names: ['bootstrap'], // needed to put webpack bootstrap code before chunks
filename: '[name].js',
minChunks: Infinity
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development')
}
}),
new AutoDllPlugin({
context: path.join(__dirname, '..'),
filename: '[name].js',
entry: {
vendor: [
'react',
'react-dom',
'react-redux',
'redux',
'history/createBrowserHistory',
'transition-group',
'redux-first-router',
'redux-first-router-link',
'fetch-everywhere',
'babel-polyfill',
'redux-devtools-extension/logOnlyInProduction'
]
}
})
]
}