Closed drernie closed 11 months ago
Possibly related to:
This team is spun off from the Modules team. We aim to implement the use cases that went unfulfilled by the initial ES modules implementation that can be achieved via loaders.
Current .mocharc.json
{
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"url" : "https://stackoverflow.com/questions/64261239/mocha-tests-with-esm-support-for-native-es6-modules"
}
Can use:
npx mocha "test/ops/*" --loader=ts-node/esm
but still get warning.
First official notice I've seen that 'import' is replacing 'loader' in node:
https://github.com/nodejs/node/issues/44094
Is --loader going away?
Sorta, it's going off-thread – so if you use it to e.g. define a global variable, it will be defined on the loader thread global scope and won't be available in the REPL anymore – but once this land, --import would be available and a better fit for your use-case.
Some details about 'register' at: https://nodejs.org/api/module.html
I just started getting a new version of this error all the time when I run mocha with TypeScript using ESM modules. Possibly due to using the latest node/npm.
Anyone else seeing this?