I am attempting to upgrade to meteor@2.3.5 from meteor@2.2.3. Development with meteor run works fine. I am getting the following stack trace when running the bundle-visualizer:
$ meteor run --extra-packages bundle-visualizer --production
...
~/.meteor/packages/standard-minifier-js/.2.6.1.1yx4gsm.sv6v++os+web.browser+web.browser.legacy+web.cordova/plugin.minifyStdJS.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 dynamic/node_modules/pdfjs-dist/build/pdf.js
at ScopeTracker.addReference
...
This seems to be a pretty low-level babel error that resurfaces from time to time as seen in the issue tracker of the babel/minify github repo.
If I remove all import pdfjs from 'pdfjs-dist'; lines (there is only one in this project) the error goes away.
Just did it by removing all dependent imports. The cumsum parsing error is gone but I still hit the error mentioned in the first post. Here is .meteor/versions:
Actually, I suspect that in the 2.2.x range 2.2.1 introduced the problem and 2.2.3 fixed it. I know it works with 2.2.3. Let me check that it does not with 2.2.1.
Interesting observation.
Letās seeā¦
2.2.1 is only Node and npm update.
2.2.2 is only a Node update
2.2.3 is a node and typescript update, but most importantly @meteorjs/babel was updated to fix a bug that was also fixed in the same manner in 2.3.5
OK. I made wrong assumptions. Here is what I can reproduce on the 2.2.x range:
2.2 with typescript (I had just added typescript to the project without running meteor update) or typescript@4.2.2: no error
2.2.1 with typescript@4.2.2: d3-array/cumsum error
2.2.2 with typescript@4.2.2: d3-array/cumsum error
2.2.3 with typescript@4.3.5: no error
I cannot combine for instance 2.2.1 with typescript@4.3.5 since this errors due to incompatible versions.
If I comment out the code dependent on d3-array/cumsum it goes through without errors, so this does not seem related to the problem I am having with pdfjs-dist.
PS: All other explicit version ranges stayed the same (.meteor/packages, .meteor/versions, and package.json).
2.2.3 was after the Node upgrade focused on fixing that d3-array error which was an error in Babel which they were constantly fixing and reverting.
It is strange that the error appeared going to 2.3.1. Though there was update to @babel/runtime. This to me suggest that maybe there might an input change to the terser which produces theses issuesā¦
Here is how I proceeded: I ran meteor update --release 2.x.y then meteor run --extra-packages bundle-visualizer --production for each version in increasing order. I ran meteor npm ci when updating from 2.2.x to 2.3 since the NodeJS version changed.
meteor create --release 2.3.5 meteor-2.3.5
cd meteor-2.3.5
meteor npm i
meteor --production # OK
meteor npm i --save pdfjs-dist
echo "import pdfjs from 'pdfjs-dist';" >> client/main.jsx
echo "console.debug(pdfjs);" >> client/main.jsx
meteor --production # NOT OK
Same outcome with TypeScript:
meteor create --release 2.3.5 --typescript meteor-2.3.5-typescript
cd meteor-2.3.5-typescript
meteor npm i
meteor --production # OK
meteor npm i --save pdfjs-dist
echo "import pdfjs from 'pdfjs-dist';" >> client/main.tsx
echo "console.debug(pdfjs);" >> client/main.tsx
meteor --production # NOT OK
meteor create --release 2.3.6 meteor-2.3.6
cd meteor-2.3.6
meteor npm i
meteor --production # OK
meteor npm i --save pdfjs-dist
echo "import pdfjs from 'pdfjs-dist';" >> client/main.jsx
echo "console.debug(pdfjs);" >> client/main.jsx
meteor --production # NOT OK
@storyteller Mmh. Same problem with METEOR@2.2.3, which is the one I am running without problem in my appā¦
meteor create --release 2.2.3 meteor-2.2.3
cd meteor-2.2.3
meteor npm i
meteor --production # OK
meteor npm i --save pdfjs-dist
echo "import pdfjs from 'pdfjs-dist';" >> client/main.jsx
echo "console.debug(pdfjs);" >> client/main.jsx
meteor --production # NOT OK