-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
What should the new moduleResolution
setting be called?
#51714
Comments
I vote for |
From reading the recommended issue, it's still not clear to me what the target is, besides bun/esbuild. I think that it's reasonable to have resolution modes that match platforms:
but also to have modes that match what users expect:
Are there more tools/bundlers that would use the proposed new mode that I missed? |
Webpack, Parcel, Browserify, maybe Rollup (they call into us for resolution so it’s debatable), Vite, Next.js I think, which uses swc. Babel does module resolution? I thought it only needs to care about one file at a time, specified via glob or something? |
Babel transpiles to CJS, so it allows ESM to be authored omitting extensions, and "index", and it ends up working the same. If it's all bundlers, then I think "bundler" is probably the right key - the only way that term would stop being accurate would be if the majority of bundlers all switched to something new - and there'd probably be a new term we all associated with that new thing anyways that would help you name the new mode. |
In that case, "what babel does" reduces to |
If we’re splitting hairs, what Babel does is orthogonal to |
If this targets bun/rebuild you could name it both as an alias, and tack on a year anyway. |
Have you considered To be honest, How about In my mind the advantage of And if you wanted to hedge your bets: And if you want internet points: |
If you're targeting a bundler, |
I think the shared heritage for the new mode is that it captures descendents/specializations of a Node-like approach. It represents some kind of lowest common denominator for mainstream use today, which also means it omits some of the features of latest Node. Here are some suggestions:
All of these escape the value judgements of |
What do people think about |
Okay I’ll bite - is this a recent meme I’m not aware of? |
It's not very recent, but here's the context |
Perfect. Commit to the bit please 😉 |
|
i vote for not even landing it till we refactored more parts of the existing system wait for nodejs 19.1 to stay for some time like 3 month at present existing experimental loader hooks get ported and that solve the resolve problem outside of ts it self. |
if you guess it is a improvement over the existing situation be brave land it as moduleResolution node at last thats what it is as node is hybrid by default and thats where all problems get caused by require supports 5+ resolve algos in a single function. |
This comment was marked as off-topic.
This comment was marked as off-topic.
I'm late to the party, but I think when this was first proposed I liked to think of this as being named |
I do think |
The problem with |
I’m up for I agree that the features the new mode shares with Node resolution are its most distinctive traits—if you give a directory named |
"chapter 10: node and ES modules (not a short chapter)" 😅
It's okay - we've had to get used to In therapy news I've nearly made peace with the spelling of HTTP referer Jokes aside, I think |
How did I never notice that |
How about So how about: I agree with the |
@andrewbranch said
A stronger distinction would be to swap the order.
|
I think it would help to clarify how the existing module resolutions mode are working. Maybe I missed whole sections in the documentation but as far as I know only At the moment it sounds like this new resolution mode is the behaviour most TypeScript developers would expect when messing around with [1] https://www.typescriptlang.org/docs/handbook/module-resolution.html#module-resolution-strategies |
Here my two cents but why not just With Whereas, the new module emerged directly from TS usage itself and represents what the TS developer community has been doing to circumvent Node resolution specific constraints in a more or less hacky way (paths alias, typesVersions etc.) as @andrewbranch already described thoroughly. Plus, it makes |
Except that there's no such thing as "TypeScript module resolution" (unless TS rewrites import paths, which is a non-starter) because there's no "TypeScript runtime"--the closest thing to that would be Deno--and you're meant to always write the paths that work at runtime. The idea is that TS doesn't impose itself on you, but instead you configure TS to align with your target environment. TypeScript is a compiler, so not a target environment. Even if people are using |
Thanks for all the suggestions. I don’t think there’s a perfect option, but I’m currently leaning toward
|
No nodey-mcnodeface! |
What about |
I’m looking for community feedback on the naming for #51669. For the full background on that PR, read #50152.
The short version is that it’s mostly designed for bundlers, but is also appropriate for runtimes like Bun, especially those that understand TypeScript natively. I initially wanted to avoid a very specific name like
bundler
that could prove to be a bad name in a few years if, say, a new wave of bundlers takes a very different approach to module resolution, or a new wave of runtimes are well-suited for the mode, or a huge number of projects use all-in-one frameworks like Next.js that are also well-suited for the mode but make it difficult to recognize what bundlers and runtimes and resolution features are actually in use.The name I first proposed in #50152 was
conventional
, because it attempts to find the common ground shared by all the popular non-Node, non-Deno resolvers I surveyed. There was some concern that this could be read as a snub to Node, Deno, and other resolvers that implement strict resolution rules for ESM, so I revivedhybrid
from #29353. Both names are intentionally vague, but I’m rethinking whether that’s a good idea.One potential mitigation for the name becoming a poor fit due to unpredictable future events is simply tacking the year onto the end:
bundler2022
. I don’t love this because if it turns out to be long-lived with the help of small, backward-compatible changes, it will falsely appear to grow increasingly outdated.Let me know your thoughts and suggestions. 🚲🏠
The text was updated successfully, but these errors were encountered: