fix(build) reduce bundle size by about 700K
app.bundle.js before: 3851549 after: 4506493. The culprit for the bloat was Olm. It feature-detects the environment in order to pick a suitable random byte generator, and alas Webpack includes the None crypto pollyfill. This is due to the existence of the "node" block in our Webpack configuration file. The solution is to provide empty modules to make bundling work, as we did already for the fs module, since we know they are not used at runtime.
This commit is contained in:
parent
794713b930
commit
69b7301b9d
|
@ -142,7 +142,8 @@ const config = {
|
||||||
// value that is a mock (/index.js).
|
// value that is a mock (/index.js).
|
||||||
__filename: true,
|
__filename: true,
|
||||||
|
|
||||||
// Provide an empty 'fs' module.
|
// Provide some empty Node modules (required by olm).
|
||||||
|
crypto: 'empty',
|
||||||
fs: 'empty'
|
fs: 'empty'
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
|
@ -190,7 +191,7 @@ module.exports = [
|
||||||
entry: {
|
entry: {
|
||||||
'app.bundle': './app.js'
|
'app.bundle': './app.js'
|
||||||
},
|
},
|
||||||
performance: getPerformanceHints(4.5 * 1024 * 1024)
|
performance: getPerformanceHints(4 * 1024 * 1024)
|
||||||
}),
|
}),
|
||||||
Object.assign({}, config, {
|
Object.assign({}, config, {
|
||||||
entry: {
|
entry: {
|
||||||
|
|
Loading…
Reference in New Issue