Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module.json #21

Open
chharvey opened this issue Sep 19, 2017 · 1 comment
Open

module.json #21

chharvey opened this issue Sep 19, 2017 · 1 comment

Comments

@chharvey
Copy link

I'm new here (both at this repo and with ES modules in general), but I was reading through the blog posts and I think I would also be unhappy with the .mjs solution. Mainly because of syntax highlighting, but also because it would be impossible to serve a single file to the server and the browser, since browsers don't know .mjs (some utility scripts could be useful on both front and back ends). I would much prefer to keep .js.

I like the idea of using metadata in a package file to indicate modules, but I was wondering…

module.json would be for ESM what package.json is for CJS. In order to be a non-breaking change, Node could learn to look for this new file, and if both files are present, module.json would take precedence over package.json. Years into the future, when CJS is dead, module.json would be the new standard. Any thoughts on this?

@guybedford
Copy link

I like the premise here. If module.json is to take over all the responsibilities of package.json then there is a risk of a lot of duplication though as interim packages will likely need both.

One approach might be to have module.json for the module directives ("main", "browser" etc), and package.json for dependency information, which unfortunately then seems like a further fragmentation without an easy deprecation path.

It seems like the right kind of thinking, but I don't see it catching unfortunately for these reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants