-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
79 lines (77 loc) · 2.15 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
const webpack = require('webpack')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const path = require('path')
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
// .BundleAnalyzerPlugin
const baseConfig = {
bail: true,
mode: 'production',
performance: {
maxAssetSize: 550000,
maxEntrypointSize: 550000
},
entry: {
index: path.resolve(__dirname, './src/index.ts')
},
stats: "errors-only",
cache: true,
resolve: {
extensions: ['.ts', '.js'],
plugins: []
},
externals: ["bindings"],
plugins: [
new webpack.ContextReplacementPlugin(/bindings$/, /^$/),
new UglifyJsPlugin({
uglifyOptions: {
parse: {
// we want uglify-js to parse ecma 8 code. However we want it to output
// ecma 5 compliant code, to avoid issues with older browsers, this is
// whey we put `ecma: 5` to the compress and output section
// https://github.com/facebook/create-react-app/pull/4234
ecma: 8
},
compress: {
ecma: 5,
warnings: false,
// Disabled because of an issue with Uglify breaking seemingly valid code:
// https://github.com/facebook/create-react-app/issues/2376
// Pending further investigation:
// https://github.com/mishoo/UglifyJS2/issues/2011
comparisons: false
},
mangle: {
safari10: true
},
output: {
ecma: 5,
comments: false,
// Turned on because emoji and regex is not minified properly using default
// https://github.com/facebook/create-react-app/issues/2488
ascii_only: true
}
},
parallel: true,
cache: true,
sourceMap: true
})
// new BundleAnalyzerPlugin({
// analyzerMode: 'disabled'
// })
],
module: {
rules: [
{
test: /\.ts$/,
loader: 'awesome-typescript-loader',
exclude: /node_modules/,
query: {
declaration: true,
configFileName: path.resolve(__dirname, 'tsconfig.build.json'),
useCache: true
}
}
]
}
}
module.exports = baseConfig