-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.prod.js
More file actions
54 lines (49 loc) · 1.83 KB
/
webpack.config.prod.js
File metadata and controls
54 lines (49 loc) · 1.83 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
const webpack = require("webpack");
const path = require("path");
const nodeExternals = require("webpack-node-externals");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
index: ["babel-polyfill", "./src/index.tsx"],
vendor: ["react", "antd", "superagent", "redux", "lodash", "nprogress", "rc-animate", "moment",
"react-dom", "react-router", "react-router-redux", "redux-actions", "redux-promise", "vega",
"d3", "vega-embed", "humanize-plus", "vega-lite"],
},
module: {
loaders: [
// All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
{ test: /\.tsx?$/, loaders: ["babel-loader?presets[]=es2015&presets[]=stage-0", "ts-loader"] },
{ test: /\.scss$/, loader: ExtractTextPlugin.extract({ fallbackLoader: "style-loader",
loader: "css-loader!sass-loader"})},
{ test: /\.css$/, loader: ExtractTextPlugin.extract({fallbackLoader: "style-loader", loader: "css"}) },
{ test: /\.(jpe?g|png|gif|svg|eot|woff|svg|ttf|json)/, loader: "file-loader" },
],
},
output: {
filename: "bundle.js",
path: __dirname + "/dist",
},
plugins: [
new ExtractTextPlugin("[name].css"),
new webpack.optimize.CommonsChunkPlugin({name: "vendor", filename: "vendor.bundle.js"}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
}),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production"),
},
}),
new HtmlWebpackPlugin({
template: "src/assets/index.html",
}),
],
resolve: {
alias: {
src: path.join(__dirname, "/src"),
},
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js"],
},
};