-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathwebpack.config.js
More file actions
37 lines (34 loc) · 910 Bytes
/
webpack.config.js
File metadata and controls
37 lines (34 loc) · 910 Bytes
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
var webpack = require("webpack");
var plugins = [
// require 'react/addons' when we require 'react'
new webpack.NormalModuleReplacementPlugin(/^react$/, 'react/addons'),
new webpack.optimize.CommonsChunkPlugin("vendor", "vendor.bundle.js"),
];
if (process.env.NODE_ENV === "production") {
plugins.push(new webpack.optimize.UglifyJsPlugin());
plugins.push(new webpack.optimize.DedupePlugin());
plugins.push(new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
}));
}
module.exports = {
cache: true,
entry: {
app: "./index.jsx",
vendor: ["react/addons"]
},
output: {
path: __dirname + "/build",
filename: "bundle.js"
},
devtool: "inline-source-map",
module: {
loaders: [
{ test: /\.less$/, loader: "style!css!less" },
{ test: /\.jsx$/, loader: "jsx?harmony&sourceMap" }
]
},
plugins: plugins
};