forked from pubkey/rxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
47 lines (42 loc) · 1.22 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
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
/**
* Throw on bailouts.
* If a dependency is causing a bailout,
* it must be replaced!
*/
const oldConsoleLog = console.log.bind(console);
console.log = function (m1, m2, m3) {
if (m1.includes('not an ECMAScript module')) {
oldConsoleLog(m1);
throw new Error('ERROR: A dependency of RxDB is causing an optimization bailout. This is not allowed.');
} else {
return oldConsoleLog(m1, m2, m3);
}
};
const plugins = [];
if (process.env.NODE_ENV === 'disc')
plugins.push(new BundleAnalyzerPlugin());
module.exports = {
mode: 'production',
entry: './config/bundle-size.js',
optimization: {
minimize: true,
minimizer: [
new TerserPlugin()
]
},
plugins,
output: {
path: path.resolve(__dirname, '../test_tmp'),
filename: 'webpack.bundle.js'
},
stats: {
/**
* @link https://webpack.js.org/plugins/module-concatenation-plugin/#debugging-optimization-bailouts
*/
optimizationBailout: true,
warnings: true
}
};