-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
executable file
·51 lines (45 loc) · 1.09 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
var path = require('path');
var webpack = require('webpack');
var production = process.env.NODE_ENV === 'production';
var plugins = []
ts_loader = 'react-hot!ts-loader!ts-jsx-loader?harmony=true',
entry = [];
if (production) {
ts_loader = 'ts-loader!ts-jsx-loader?harmony=true';
plugins = plugins.concat([
new webpack.optimize.UglifyJsPlugin({
mangle: true,
compress: {
warnings: false, // Suppress uglification warnings
},
})
]);
entry = ['./src/app.tsx'];
}
else {
entry = [
'./src/app.tsx',
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server'
];
}
module.exports = {
entry: entry,
output: {
path: path.join(__dirname, 'build'),
filename: 'bundle.js',
publicPath: '/build/'
},
devtool: 'source-map',
plugins: plugins,
resolve: {
extensions: ['', '.ts', '.tsx', '.js']
},
module: {
loaders: [
{test: /\.ts(x?)$/, loader: ts_loader},
{test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'},
{test: /\.jpg|png$/, loader: "url-loader?limit=100000"}
]
}
}