Skip to content
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

Define path aliases only once #1547

Open
brillout opened this issue Mar 12, 2024 · 2 comments
Open

Define path aliases only once #1547

brillout opened this issue Mar 12, 2024 · 2 comments

Comments

@brillout
Copy link
Member

Description

Instead of having to define path aliases up to two times (as described in https://vike.dev/path-aliases), it would be nice if users can define their path aliases only once.

JavaScript users would define aliases only once at their package.json#imports.

TypeScript users would define aliases only once at tsconfig.json#compilerOptions.paths.

We can then show a warning/error if the user attemps to define a path alias using vite.config.js. (I believe if Vike uses a config() hook instead of configResolved() it can apply the warning/error only to path aliases set by the user, and not to path aliases set by Vite plugins.)

@brillout
Copy link
Member Author

A correct implement isn't trivial, see rolldown/rolldown#637.

Instead, Vike could support this if and only if tsconfig.json#compilerOptions.paths/package.json#imports lives in the same directory than vite.config.js.

@brillout
Copy link
Member Author

It's on Vite's radar: https://twitter.com/youyuxi/status/1770453125067149448.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant