-
Notifications
You must be signed in to change notification settings - Fork 916
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
[Enhancement] Add webDependency alias support #201
Comments
I am interested in trying that. Instead of adding an |
A tuple is what I used in that code snippet above. Curious what you mean if you want to share an example of the interface you're picturing. I'd recommend we walk through what you're thinking in this issue before you start coding, just to save time later on down the road. |
Thank you for that, indeed that would be helpful :) My idea was to change the type of |
Sounds good! Your goal should be to pass something like |
I think this is related, is there a way to deep import a minified prod .js file for prod, and a non-minified dev .js file for dev? I want them to map to the same file in the web_modules folder. An example would be deep importing the .js file from the npm module for React, where it has separate distributions for dev/prod. |
I'm using Vue and it has several builds too, so I think this feature is really necessary. One alternative to your suggestion is to have seperated The configuration syntax can be |
The per-env aliasing is an interesting idea, especially since ESM doesn't really have the ability to conditionally serve different package code based on NODE_ENV the same way that CJS does. It may be the responsibility of the package installer. Lets tackle separately from this PR. @ChristopherBiscardi would still love to get this merged if you're available to get it over the line! |
I put this on my schedule to finish up tomorrow |
resolved via #249 |
We've seen a few requests come in to improve the "deep import" experience, and I think it makes sense to tackle that now. Especially as we start to bring in more Webpack users with existing apps/dependency trees, it makes sense to have a way to manually configure the package entrypoint and still use the package name as the import.
Today, to use a custom package entrypoint you need to do:
Instead, we should be able to do:
Thoughts on the syntax? I don't have too strong of an opinion on tuple-array vs. object to define an alias, but I think simple is better at this point, so that if we DO decide we want some more complex syntax down the road we can easily map the old syntax to the new one (and deprecate it without removing it entirely).
Would love some help on this one, if anyone is interested! It shouldn't be too tricky, and will most likely involve adding an
alias
property toInstallTarget
and then using that duringinstall()
instead of callinggetWebDependencyName()
to calculate the final location ourself like we normally do.The text was updated successfully, but these errors were encountered: