-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.web.config.js
More file actions
97 lines (93 loc) · 2.42 KB
/
webpack.web.config.js
File metadata and controls
97 lines (93 loc) · 2.42 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
var webpack = require("webpack");
var path = require("path");
var autoprefixer = require("autoprefixer");
var prod = (process.env.NODE_ENV === "production");
var plugins = [
new webpack.ProvidePlugin({
_: "lodash"
}),
new webpack.DefinePlugin({
"process.env": {
"CLIENT_ID": JSON.stringify(process.env.CLIENT_ID || "checkpoints.web"),
"API_BASE": JSON.stringify("/api"),
"CLOUDINARY": JSON.stringify({ cloud_name: "checkpoints" }),
"NODE_ENV": JSON.stringify(process.env.NODE_ENV || "dev")
}
})
];
if (prod)
plugins.push(new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }));
module.exports = {
entry: {
"app": ["babel-polyfill", "./web/App.tsx"],
"vendor": [
"classnames",
"dateformat",
"flexboxgrid",
"immutability-helper",
"lodash",
"querystring",
"react-addons-css-transition-group",
"react-addons-shallow-compare",
"react-addons-transition-group",
"react-dom",
"react-dropzone",
"react-geosuggest",
"react-linkify",
"react-measure",
"react-redux",
"react-router",
"react-router-redux",
"redux",
"redux-form",
"redux-thunk",
"validator",
"whatwg-fetch"
]
},
output: {
path: path.join(__dirname, "web/dist"),
filename: "bundle.js"
},
devtool: prod ? "none" : "eval",
resolve: {
extensions: ["", ".ts", ".tsx", ".js"]
},
plugins: plugins.concat([
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
chunks: "bundle",
filename: "vendor.bundle.js",
minChunks: Infinity
})
]),
module: {
loaders: [
{ test: /\.css$/, loader: "style-loader!css-loader!postcss-loader" },
{ test: /\.scss$/, loaders: ["style", "css", "postcss", "sass"] },
{ test: /\.tsx?$/, loaders: prod ? ["babel-loader?presets[]=es2015", "ts"] : ["ts"] },
{ test: /\.json$/, loader: "json-loader" },
{ test: /\.png$/, loader: "url-loader", query: { mimetype: "image/png" } }
],
preloaders: [
{ test: /\.js$/, loader: "source-map-loader" }
]
},
postcss: () => [autoprefixer],
devServer: {
proxy: {
"/api": {
target: "http://localhost:3000",
secure: false
},
"/static": {
target: "http://localhost:3000",
secure: false
}
},
historyApiFallback: true
},
ts: {
configFileName: 'tsconfig.web.json'
}
};