This repository has been archived by the owner on Feb 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.config.js
69 lines (64 loc) · 1.74 KB
/
webpack.config.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
/**
* Webpack production configuration
*/
/*globals __dirname:false */
// css-loader requires promises and must be polyfilled for use on Node 0.10.x
require("es6-promise").polyfill();
var path = require("path");
var webpack = require("webpack");
var CleanPlugin = require("clean-webpack-plugin");
var StatsWriterPlugin = require("webpack-stats-plugin").StatsWriterPlugin;
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
cache: true,
context: path.join(__dirname, "client"),
entry: "./app.jsx",
output: {
path: path.join(__dirname, "dist/js"),
filename: "bundle.[hash].js"
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: [/node_modules/],
loaders: ["babel-loader?optional=runtime&stage=2"]
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
},
{
test: /\.(png|svg|woff|woff2|ttf|eot)$/i,
loader: "url-loader?limit=10000"
}
]
},
resolve: {
extensions: ["", ".js", ".jsx"]
},
plugins: [
// Clean
new CleanPlugin(["dist"]),
// Optimize
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin(),
// Extract CSS
new ExtractTextPlugin("style.[hash].css"),
// Meta, debug info.
new webpack.DefinePlugin({
"process.env": {
// Signal production mode for React JS libs.
NODE_ENV: JSON.stringify("production")
}
}),
new webpack.SourceMapDevToolPlugin(
"../map/[file].map",
"\n//# sourceMappingURL=http://127.0.0.1:3001/dist/map/[url]"
),
new StatsWriterPlugin({
// Context is relative to `output.path` / `dist/js`
filename: "../server/stats.json"
})
]
};