-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
vite.config.ts
should resolve alias from compilerOptions.paths
in tsconfig.json
#16718
Comments
Start a new pull request in StackBlitz Codeflow. |
Currently, TS source code doesn't resolve aliases from |
What does this mean again? |
If tsconfig alias would work in a config file, it should also work in your source code files for consistency. |
But technically it does work if i feel like support for tsconfig paths in vite.config.ts is a different issue that currently doesn't have an easy workaround? (cmiiw) |
What is the consideration for the vite team to add/not add this feature? |
i dont know if this work, but what about execute the |
The vite config is usually used by vite's server, e.g. executing Unless you mean transpiling CMIIW |
Yes, but
I think you can still use relative imports?
There's still mixed opinions about this. My opinion is https://x.com/robpalmer2/status/1770612164396515667 and the result in #6828 (comment). Others think that supporting tsconfig alias would be convenient and rustifying the resolver would solve the performance issue, and that |
having this ability would be great, especially in a nx monorepo. i usually need to call certain functions in from other packages in the |
Closing this as it's something we don't plan on supporting for now. |
Description
Some plugin configurations require a complex object that might be split across the codebase
For instance, CRXJS Vite Plugin requires a
manifest.json
file, which might/might not require an (possible aliased) import from another fileReproduction link here
Right now, vite does not resolve alias paths within vite.config.ts or it's dependencies
Example of such case:
Example of another case:
Both cases will throw error when running an instance of the vite server
Suggested solution
Maybe consider using
compilerOptions.paths
to resolve the imports invite.config.ts
somewhere in the plugin pipelineAlternative
I'm also considering creating a plugin that creates a workaround, still not 100% sure on how to accomplish this though
Additional context
I've received quite a bit of concern and confusion regarding consumers of vite not being able to utilize aliases in
vite.config.ts
, and I believe it'd be an issue worth looking atValidations
The text was updated successfully, but these errors were encountered: