-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.dev.js
57 lines (56 loc) · 1.28 KB
/
webpack.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
const path = require('path');
const webpack = require('webpack');
const cleanPlugin = require('clean-webpack-plugin');
module.exports = {
entry: {
app: ["./app/src/index"],
vendor: ['react']
},
output: {
path: path.join(__dirname, "app/dist"),
filename: "[name].js",
// publicPath: "http://localhost:8080/app/dist",
chunkFilename: "[name].js"
},
resolve: {
extensions: ['*', '.js', '.jsx', '.less', '.scss', '.css'],
modules: ['node_modules', './app/src']
},
module: {
loaders: [{
test: /\.js[x]?$/,
include: path.join(__dirname, "app/src"),
exclude: /node_modules/,
loader: "babel-loader"
}, {
test:/\.css$/,
loader:"style-loader!css-loader?modules"
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('development')
},
BASE_URL: JSON.stringify('http://localhost:8001'),
}),
// webpack 2 不再支持
// new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new cleanPlugin([path.join(__dirname, "app/dist")]),
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor'],
filename: 'vendor.js'
})
],
devServer: {
port: 8080,
contentBase: ".",
hot: true,
historyApiFallback: true,
publicPath: "/app/dist",
stats: {
colors: true
}
}
}