How to stub ES module imports documentation is incorrect
Documentation was added in #2676 (~2 months ago)
I tried following it and discovered that it is, in fact, incorrect, at least when using the most recent version of esm.
The set up file, according to the instructions, should look like this:
require = require("esm")(module, {
cjs: true,
mutableNamespace: true,
});however, if you look on esm documentation (https://www.npmjs.com/package/esm#options), you can see that mutableNamespace is NOT a top-level key. It should be set up like this:
require = require("esm")(module, {
cjs: {mutableNamespace: true}
});Given that the foundation of this documentation is incorrect, it makes me doubt if this has actually been verified by a human, and I think that incorrect docs are worse than no docs at all.
I hope you are able to either delete the file, or mark it as "unverified" tutorial, after updating the esm config. Thank you in advance
Source: sinonjs/sinon