-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.babel.js
100 lines (93 loc) · 1.93 KB
/
webpack.config.dev.babel.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import webpack from 'webpack';
import path from 'path';
const sourcePath = path.join(__dirname, './app');
const distPath = path.join(__dirname, './dist/');
const nodeEnv = 'development';
const plugins = [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: 'vendor.bundle.js',
}),
new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify(nodeEnv) },
}),
new webpack.NamedModulesPlugin(),
];
plugins.push(new webpack.HotModuleReplacementPlugin());
module.exports = {
devtool: 'eval',
context: sourcePath,
entry: {
js: ['./Index.jsx', 'webpack-hot-middleware/client?reload=true'],
vendor: ['react', 'immutable', 'react-dom', 'react-redux', 'redux', 'redux-thunk'],
},
output: {
path: distPath,
filename: '[name].bundle.js',
},
module: {
rules: [
{
test: /\.html$/,
exclude: /node_modules/,
use: {
loader: 'file-loader',
query: {
name: '[name].[ext]',
},
},
},
{
test: /\.css$/,
exclude: /node_modules/,
use: [
'style-loader',
'css-loader',
],
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: [
'babel-loader',
],
},
],
},
resolve: {
extensions: ['.js', '.jsx'],
modules: [
path.resolve(__dirname, 'node_modules'),
sourcePath,
],
},
plugins,
stats: {
colors: {
green: '\u001b[32m',
},
},
devServer: {
contentBase: './',
historyApiFallback: true,
port: 3000,
compress: false,
inline: true,
hot: true,
stats: {
assets: true,
children: false,
chunks: false,
hash: false,
modules: false,
publicPath: false,
timings: true,
version: false,
warnings: true,
colors: {
green: '\u001b[32m',
},
},
},
};