-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack.config.js
More file actions
40 lines (36 loc) · 898 Bytes
/
Copy pathwebpack.config.js
File metadata and controls
40 lines (36 loc) · 898 Bytes
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
const { join } = require('path');
const webpack = require('webpack');
const isProd = process.env.NODE_ENV === 'production';
const ifProd = (plugin) => isProd ? plugin : null;
const notNull = plugin => plugin !== null;
const removeNull = plugins => plugins.filter(notNull);
module.exports = {
entry: './src/main.tsx',
output: {
path: join(__dirname, 'build'),
filename: 'main.js',
},
resolve: {
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js', '.json'],
},
plugins: removeNull([
ifProd(new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"',
},
})),
ifProd(new webpack.optimize.UglifyJsPlugin({
compress: {
screw_ie8: true,
warnings: false,
},
})),
]),
devServer: {
inline: true,
port: 1337,
},
module: {
rules: [{ test: /\.tsx?$/, use: 'ts-loader' }],
},
};