-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.dev.js
78 lines (77 loc) · 2.29 KB
/
webpack.config.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
// jscs:disable
const path = require("path");
const webpack = require("webpack");
const OccurrenceOrderPlugin = new webpack.optimize.OccurrenceOrderPlugin();
module.exports = {
devtool: "cheap-module-source-map",
entry: {
bundle: [
"webpack-hot-middleware/client",
"webpack/hot/only-dev-server",
"react-hot-loader/patch",
"./src/index.js",
"./public/styles/index.less"
],
vendor: [
"react",
"react-dom",
"animate.css/animate.min.css",
"semantic-ui-css/semantic.min.css"
]
},
output: {
path: path.join(__dirname, "build/public"),
filename: "[name].js",
chunkFilename: "[id].chunk.js",
publicPath: "/build/public/"
},
plugins: [
OccurrenceOrderPlugin,
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
filename: "vendor.js",
minChunks: 2
}),
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify("development"),
"__DEV__": true
})
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: path.join(__dirname, "node_modules"),
use: ["react-hot-loader/webpack", "babel-loader"],
include: path.join(__dirname, "src")
},
{
test: /\.(less|css)$/,
use: [
"style-loader",
{
loader: "css-loader",
options: {
sourceMap: true,
camelCase: true
}
},
{
loader: "less-loader",
options: {
sourceMap: true,
importLoaders: 1,
camelCase: true,
strictMath: true
}
}
]
},
{
test: /\.(svg|png|woff|woff2|jpg|gif|ttf|eot)$/,
use: "url-loader"
}
]
}
};