-
Notifications
You must be signed in to change notification settings - Fork 205
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
Alias with array of paths #261
Comments
Hmm.. Would this really be helpful? What's your usecase for somethine like this? Looks like risky to code a project with a behavior like that. |
I'm removing the +1 comment - please use the emoji system instead. Commenting like this notifies all people subscribed to the issue and all of the maintainers, and doesn't bring much value. If you want to support the idea, use +1 on the original post. |
Describing my use case to support this idea. I have both frontend and backend in same project folder, separated in sub folders. Eslint (which also uses this plugin) is in the root with the configuration shared from both frontend and backend. I would like to alias the character ~ to the relative root [`/backend, /frontend], without using 2 different aliases. Example: {
"root": ["."],
"alias": {
"~": ["./backend", "./frontend"]
}
} Not a big deal to have different aliases, but simply to have a consistent "root" alias character 👍 |
Have you tried having |
Thank you for your answer! In my case, babel is not the problem but eslint For now I'll stick with multiple aliases, which is by far still a good thing, thanks 👍 |
But eslint uses the resolver from the babel plugin, so I'm not sure why it fails. If babel is able to do it, eslint should be too. If you have a test repo where I can test this, it would help :) |
For |
|
This feature would be useful when you have multiple components and you want to import, say This could look like this.
When doing |
This would be really useful for me when using typescript. Tsconfig supports an array of paths, and my project relies on it. |
I think it would make sense for
alias
to work in a similar way toroot
- accept an array of strings/functions that will execute sequentially until one is found.This would be used with
require('foo/someFile')
. Ifsrc/someModule1/someFile
exists, this will be selected. Else ifsrc/someModule2/someFile
exists, this will be selected. Else, an error is thrown as the file cannot be found.Do we agree this would be useful (and cannot be done currently)?
The text was updated successfully, but these errors were encountered: