Skip to content

esm: unflag extensionless ES module JavaScript and Wasm in module scope

This includes work by @LiviaMedeiros in https://github.com/nodejs/node/pull/49531, https://github.com/nodejs/node/pull/49629, and https://github.com/nodejs/node/pull/49540.

Following up from #49869, this PR allows extensionless ESM JavaScript and Wasm files within "type": "module" package scopes to run as entry points or be imported. This can be done as a semver-minor change because currently such files error when they are within a module scope. (Outside of such a scope, they are interpreted as CommonJS modules unless --experimental-default-type=module is passed.)

This was discussed in the most recent TSC meeting, https://github.com/nodejs/TSC/issues/1442. At that meeting it was agreed that this change could go out in 21.0.0, but not immediately in 20.x or below. It doesn’t need to be restricted from 20.x indefinitely, but there was a request to hold off on backporting it to 20.x until it had been public in 21.x for a bit. I’ve added labels accordingly.

@nodejs/loaders @nodejs/wasi

Merge request reports

Loading