esm: replace --entry-type with --input-type by GeoffreyBooth · Pull Request #27184 · nodejs/node (original) (raw)

This is a change discussed and approved by the modules working group per our meeting today on 2019-04-10. We’re hoping that this change can be merged in before the release of Node 12.

Per nodejs/modules#300 (comment), this PR replaces --entry-type with --input-type, a flag just like --entry-type but only for --eval, --print and STDIN.

This way we still provide a way to use ESM in those non-file inputs, but we’re removing the footgun that is --entry-type in its current form. To use ESM in files, the files need to end in .mjs or be in a "type": "module" package scope.

Tests and docs updated.

Checklist