-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
45 lines (40 loc) · 976 Bytes
/
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
var path = require('path');
var webpack = require('webpack');
var isProd = (process.env.NODE_ENV !== 'dev');
function getPlugins() {
var plugins = [
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': process.env.NODE_ENV
}
})
];
return plugins;
}
const config = {
mode: process.env.NODE_ENV !== 'dev' ? 'production' : 'development',
entry: './src/asteroids.ts',
optimization: {
minimize: false
},
output: {
path: path.resolve(__dirname, 'build'),
filename: 'asteroids.js',
publicPath: "/build/"
},
resolve: {
extensions: ['.webpack.js', '.web.js', '.ts', '.js']
},
plugins: getPlugins(),
module: {
rules: [
{ test: /\.ts$/, loader: 'ts-loader' },
{ test: /\.wav/, loader: 'file-loader' }
]
}
};
if (isProd) {
config.optimization.minimize = true;
}
module.exports = config;