-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config-prod.js
55 lines (53 loc) · 1.47 KB
/
webpack.config-prod.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
var webpack = require("webpack");
var path = require("path");
module.exports = {
entry: [
"babel-polyfill", // babel's es6 environemt
"./src/js/app.jsx" // panorama
],
output: {
path: path.join(__dirname, "/dist"),
filename: "bundle.js"
},
module: {
loaders: [
{
loader: "babel-loader",
// process only files in src directory
include: [
path.resolve(__dirname, "src")
],
// only run js and jsx files thourgh babel
test: /\.jsx?/,
// babel config options
query: {
plugins: ['transform-runtime'],
presets: ['es2015', 'react']
}
},
{
test: /\.css$/,
loader: 'style-loader?singleton!css-loader?sourceMap'
}
]
},
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: [
function() {
this.plugin("done", function(stats) {
if (stats.compilation.errors && stats.compilation.errors.length > 0) {
console.log("$$$$ there are " + stats.compilation.errors.length + " errors");
console.log(stats.toJson().errors[0]);
process.exit(1);
}
});
},
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: '"production"'
}
})
]
}