-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-staging.config.js
66 lines (65 loc) · 2.42 KB
/
webpack-staging.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
var path = require("path");
var webpack = require("webpack");
var HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
cache: false,
devtool: "source-map",
entry: {
app: [
path.join(__dirname, "src/app/App.jsx")
],
vendor: [ "d3", "react", "react-dom", "superagent", "react-tooltip" ]
},
resolve: {
// When requiring, you don't need to add these extensions
extensions: ["", ".js", ".jsx"],
alias: {
"react": path.resolve(__dirname, "node_modules/react"),
"react-dom": path.resolve(__dirname, "node_modules/react-dom"),
"react-router": path.resolve(__dirname, "node_modules/react-router"),
"@roam/react-shared": path.resolve(__dirname, "node_modules/@roam/react-shared/src"),
"assets": path.resolve(__dirname, "src/assets")
},
root: path.resolve(__dirname, "src/app"),
},
output: {
path: path.join(__dirname, "dist"),
filename: "main.[chunkhash].js",
publicPath: "/"
},
plugins: [
new webpack.optimize.CommonsChunkPlugin("vendor", "vendor.[chunkhash].js"),
new HtmlWebpackPlugin({
inject: true,
template: path.join(__dirname, "src/public/index.html"),
minify: {
removeComments: true,
collapseWhitespace: true,
minifyJS: true
}
}),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
}),
new webpack.optimize.UglifyJsPlugin({ compress: false })
],
module: {
loaders: [
{ test: /\.css$/, loader: "style-loader!css-loader" },
{ test: /\.(js|jsx)$/, loaders: [ "react-hot", "babel-loader" ], include: [ path.join(__dirname, "src"), path.resolve(__dirname, "../react-shared/src") ] },
{ test: /\.less$/, loader: "style!css!less" },
{ test: /\.json$/, loader: "json-loader" },
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
{ test: /\.(png|jpg|jpeg|gif)?$/, loader: "file" },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" }
]
},
eslint: {
configFile: path.resolve(__dirname, "../src/.eslintrc")
}
};