-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack.config.dev.js
More file actions
93 lines (86 loc) · 2.39 KB
/
Copy pathwebpack.config.dev.js
File metadata and controls
93 lines (86 loc) · 2.39 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
const path = require("path");
const webpack = require("webpack");
const StatsWriterPlugin = require("webpack-stats-plugin").StatsWriterPlugin;
module.exports = {
name: "app",
devtool: "eval-source-map", //devtool: 'eval' for maximum build performance
entry: {
vendors: [
"react-hot-loader/patch",
"webpack-dev-server/client?http://localhost:3001/",
"./src/client/__vendors__.js"
],
app: "./src/client/__app__.js"
},
output: {
path: path.join(__dirname, "build/static"),
publicPath: "/static/",
filename: "js/[name].js"
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("development")
}
}),
new StatsWriterPlugin({
filename: "assets.json"
}),
//The minChunks function ensures vendors only includes those files that are produced from 3rd party vendors,
//namely anything in the node_modules folder
new webpack.optimize.CommonsChunkPlugin({
name: "vendors",
minChunks: function(module) {
return module.context && module.context.indexOf("node_modules") !== -1;
}
}),
//The minChunks: Infinity creates a separate chunk, `manifest`, that contains only bootstrapping information
//required by Webpack compiled modules
new webpack.optimize.CommonsChunkPlugin({
name: "manifest",
minChunks: Infinity
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
// new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
new webpack.NoEmitOnErrorsPlugin()
],
module: {
rules: [
{
test: /\.jsx?$/,
use: [
"react-hot-loader/webpack",
{
loader: "babel-loader",
options: {
babelrc: false,
presets: [["es2015", { modules: false }], "react", "stage-0"],
plugins: [
"react-hot-loader/babel",
[
"transform-runtime",
{
polyfill: true,
regenerator: true
}
],
"transform-react-jsx-source"
]
}
}
],
exclude: /node_modules/
},
{
test: /\.json$/,
loaders: ["json-loader"]
}
]
},
devServer: {
hot: true,
compress: true,
port: 3001
}
};