I was recently trying out a new NPM package and when I tried to deploy to staging the build was either running out of memory (with max_old_space_size =4096 ) or then failing in the minimiser if I increased it to 5120.
Errors prevented bundling:
While minifying app code:
/home/runner/.meteor/packages/zodern_standard-minifier-js/.4.1.1.12dbnq1.dvjo++os+web.browser+web.browser.legacy+web.cordova/plugin.fastMinifier.os/npm/node_modules/meteor/babel-compiler/node_modules/babel-plugin-minify-mangle-names/lib/scope-tracker.js:47:34:
unknown: Cannot read property 'add' of undefined while minifying
packages/modules.js
at ScopeTracker.addReference
(/home/runner/.meteor/packages/zodern_standard-minifier-js/.4.1.1.12dbnq1.dvjo++os+web.browser+web.browser.legacy+web.cordova/plugin.fastMinifier.os/npm/node_modules/meteor/babel-compiler/node_modules/babel-plugin-minify-mangle-names/lib/scope-tracker.js:47:34)
at ReferencedIdentifier
(/home/runner/.meteor/packages/zodern_standard-minifier-js/.4.1.1.12dbnq1.dvjo++os+web.browser+web.browser.legacy+web.cordova/plugin.fastMinifier.os/npm/node_modules/meteor/babel-compiler/node_modules/babel-plugin-minify-mangle-names/lib/index.js:196:26)
at newFn
(/home/runner/.meteor/packages/zodern_standard-minifier-js/.4.1.1.12dbnq1.dvjo++os+web.browser+web.browser.legacy+web.cordova/plugin.fastMinifier.os/npm/node_modules/meteor/babel-compiler/node_modules/@babel/traverse/lib/visitors.js:212:17)
at bfsTraverse
The package I added was a really small and simple one - csvbox but it has conditional chaining.
This should be ok right?
I tried using the recompile options as specified here but that didn’t help. It took a long time though.
So in the end I forked the package, removed the optional chaining and all is good.
We don’t have any special babel config or anything
Any ideas?