Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
node --experimental-modules does not allow running files without an extension #16605
Assuming the file
But this won't:
node --experimental-modules ./node_modules/.bin/mocha
It fails with
But unfortunately, once
Not sure how to resolve this, but I'm assuming that for reasons of backward compatibility, once we are out of the experiment, then this MUST work and resolve to CJS. I see two options going forward:
While I prefer option #1 when the ESM dust settles in a few years, for the present I would prefer option #2 given that its an exception to the rule "MJS" if and only if "ESM", and because the rules surrounding ESM are not yet intuitive to everybody.
This bug is somewhat a companion bug to #16476.