-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
61 lines (53 loc) · 1.44 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
var CopyWebpackPlugin = require('copy-webpack-plugin');
var webpack = require('webpack');
var path = require('path');
var PROD = JSON.stringify(process.env.NODE_ENV) === 'production';
var plugins = [
new CopyWebpackPlugin([
{ from: 'public'},
{ from: 'node_modules/flexboxgrid/dist/flexboxgrid.min.css', to: 'css'}
]),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
'process.env.SERVER_HOSTNAME': JSON.stringify(process.env.SERVER_HOSTNAME)
})
];
if (PROD) plugins.push(new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {
warnings: false,
booleans: false,
unused: false
}
}));
module.exports = {
entry: "./app/index.tsx",
output: {
filename: "app.js",
path: path.resolve(__dirname, "dist", "public")
},
devtool: "source-map",
resolve: {
extensions: ["", ".ts", ".tsx", ".js", ".jsx"]
},
module: {
loaders: [
{ test: /\.(tsx|ts)$/, loader: "awesome-typescript-loader" }
],
preLoaders: [
{ test: /\.js$/, loader: "source-map-loader" }
]
},
plugins: plugins,
devServer: {
historyApiFallback: true,
proxy: {
"/api": "http://localhost:3000",
"/auth": "http://localhost:3000"
}
},
node: {
fs: 'empty',
tls: 'empty'
}
};