Uh oh!
There was an error while loading. Please reload this page.
Exports main - #41
Conversation
MylesBorins
commented
Feb 26, 2019
@guybedford can you update the commits to have a namespace e.g. |
d2a9c45 to
61a215fCompare61a215f to
10290e9Compare
ljharb
left a comment
There was a problem hiding this comment.
Per comment on the issue; without extension lookup i don’t think we should merge this.
GeoffreyBooth
commented
Feb 26, 2019
Per the issue discussion, this PR doesn’t involve extension lookup. Even if extension lookup is added, this PR would still apply. |
ljharb
commented
Feb 26, 2019
I disagree; with extension lookup, there's no need for an additional field at all, since the file extension would determine parsing goal (and a separate field to override parse goal per extension would continue to be useful). |
GeoffreyBooth
commented
Feb 26, 2019
As was noted in that thread, a single field only works if the two files are side-by-side differing only in extension, e.g. |
ljharb
commented
Feb 26, 2019
@GeoffreyBooth in that model, you'd transpile/copy two files, and have |
GeoffreyBooth
commented
Feb 27, 2019
That’s a much bigger burden on developers, to have essentially two build pipelines. Also there are a lot of developers who will want to use About the only advantage
For all these reasons and a few I can’t think of at the moment, we judge |
ljharb
commented
Feb 27, 2019
It's a fair point that even with extension lookup, we might still want a way to have an alternative "main". However, since deep imports are important as well, imo it's not really sufficient unless we can provide an alternative root directory for the package, ie, Re (Another alternative is to not use a Every build tool already implements node's searching algorithm - in practice this has proven to not be a hardship. Similarly, loaders would need to expose a way for build tools to tap into their resolution algorithm, otherwise they wouldn't work for build tools anyways (unrelated to extension searching). |
@ljharb As you know, one of the goals of the import file specifier resolution proposal was to support ESM in The
I support a way to map extensions, whether via some new |
ljharb
commented
Feb 27, 2019
I agree they shouldn't be required to use Your desire - to avoid using I'm going to continue blocking PRs that I don't think are a good fit - half measures are worse than none imo. For me, the goal of "let people not use |
devsnek
commented
Feb 27, 2019
not entirely in the same context but this addresses the points of mjs because of course mjs has to keep coming up again and again :( please read this: nodejs/modules#253 (comment) i see absolutely no reason for node to encourage any file extension for new stmr files besides |
GeoffreyBooth
commented
Feb 27, 2019
Since we both agree that users shouldn’t be required to use |
Refs: nodejs/modules#180 PR-URL: nodejs#6 Reviewed-By: Myles Borins <MylesBorins@google.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Refs: nodejs/modules#180 PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Refs: nodejs/modules#180 PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Refs: nodejs/modules#180 PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
PR-URL: nodejs#6 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Myles Borins <mylesborins@google.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
9301a06 to
e721cd2Compare484d1fb to
7efc53dComparec7fa700 to
d69f765Compare335d584 to
9a343ceCompare3a00b51 to
bc101f6Comparefd5b55a to
3a40599Compare
This supports the package.json "exports" main to allow dual mode workflows, as described in nodejs/modules#273.
In addition some minor refinements around file extension handling are provided as well, specifically disabling support for
.nodeand.jsonmains in CommonJS packages when loaded from ESM.