Chai v5 and other ESM-only npm packages

Today I was upgrading chai to it’s new Major version 5 (Note I’m on Meteor 2.14 with this).
Chai 5 is ESM-only now but I thought the Meteor tool will likely to handle that easily.

However, I once I want to import it in a test file via

import chai from 'chai'

I get the following error:

W20240201-10:12:53.327(1)? (STDERR) packages/modules.js:1362
W20240201-10:12:53.328(1)? (STDERR)   static {
W20240201-10:12:53.328(1)? (STDERR)          ^
W20240201-10:12:53.328(1)? (STDERR) 
W20240201-10:12:53.329(1)? (STDERR) SyntaxError: Unexpected token '{'
W20240201-10:12:53.329(1)? (STDERR)     at new Script (vm.js:102:7)
W20240201-10:12:53.329(1)? (STDERR)     at createScript (vm.js:262:10)
W20240201-10:12:53.329(1)? (STDERR)     at Object.runInThisContext (vm.js:310:10)
W20240201-10:12:53.329(1)? (STDERR)     at /tmp/meteor-test-run1y1opir.pssv/.meteor/local/build/programs/server/boot.js:354:32
W20240201-10:12:53.329(1)? (STDERR)     at Array.forEach (<anonymous>)
W20240201-10:12:53.329(1)? (STDERR)     at /tmp/meteor-test-run1y1opir.pssv/.meteor/local/build/programs/server/boot.js:210:21
W20240201-10:12:53.329(1)? (STDERR)     at /tmp/meteor-test-run1y1opir.pssv/.meteor/local/build/programs/server/boot.js:423:7
W20240201-10:12:53.329(1)? (STDERR)     at Function.run (/tmp/meteor-test-run1y1opir.pssv/.meteor/local/build/programs/server/profile.js:256:14)
W20240201-10:12:53.329(1)? (STDERR)     at /tmp/meteor-test-run1y1opir.pssv/.meteor/local/build/programs/server/boot.js:422:13

Anyone has similar issues with other ESM-only packages?

Is this maybe related to this post:

There is an existing discussion here

1 Like

So it’s basically still not supported in Meteor and from what I see also not in Meteor 3, right!?

Yes (based on that discussion). I also have half a dozen packages that are no longer updated because of ESM support (aside from packages no longer supporting Node 14). There were mentions of ESM in other discussions, but I can no longer remember the conclusion.

@storyteller or @zodern seems to know more about the status