because it does no longer define the global "chai" (im using chai.should(), otherwise this might work)
Next try:
import {chai} from '../node_modules/chai/chai.js';
->
Uncaught SyntaxError: The requested module '../node_modules/chai/chai.js' does not provide an export named 'chai'
Aaaah, got it:
import {should} from '../node_modules/chai/chai.js';
should(); // was: chai.should()
This took me some time to figure out, a documentation update might help.
TLDR: You need to change
to
If you are using imperative Chai API calls like
chai.should()
you must use it in your own ESMs like this:The rest is documenting my journey to get it working again (I thought I couldn't fix this and wanted to file a bug for that):
Chai stopped working in the browser.
Old setup:
This now fails with
Making it a module:
Fails with
because it does no longer define the global "chai" (im using
chai.should()
, otherwise this might work)Next try:
Aaaah, got it: