-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I really like that this proposal includes removing the file extension checks, as this will help get closer to code that works in browsers as well.
In line with this, it might be worth considering removing directory index support as well, although only for the "default.js" directory index.
The "default.js" would still be supported as the fallback package main though.
This way there is a forwards compatibility path to deprecating directory indexes entirely.
It would still allow CommonJS fallbacks (import "./x" -> "/x/index.js") allowing a gradual upgrade path of converting some package modules into ES modules while still supporting loading local CommonJS files.
The dual-mode subpath loads (import "pkg/x" v require("pkg/x")) can then need to be handled by import "pkg/x.js" and require('pkg/x.cjs.js') being distinct (or x.mjs and x.js).
@zenparsing would you be open to considering something along these lines? Can send a PR if you think it might be a worthwhile direction.