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

docs: add migration hint for alias resolving #1348

Merged
merged 3 commits into from
Jan 4, 2021
Merged

docs: add migration hint for alias resolving #1348

merged 3 commits into from
Jan 4, 2021

Conversation

timozander
Copy link
Contributor

While migrating to Vite 2, I found myself having trouble with my alias config. The Migration guide did not explicitly mention the change to @rollup/plugin-alias and the implications of that.

PR aims at clarifying that. 😄

Migration guide did not explicitly mention how to migrate existing `alias` entries
@yyx990803
Copy link
Member

This seems to have bitten a lot of people - the change is in 2.0 it's a direct replacement, so if the replacement doesn't end with a slash, /@foo/bar will be resolved as /.../some-special-dirbar (missing the slash in between).

The regex works, but you can do without a regex by ensuring an ending slash:

alias: { '/@foo/': path.resolve(__dirname, 'some-special-dir') + '/' }

@timozander
Copy link
Contributor Author

timozander commented Jan 4, 2021

Thanks, didn't realize that. I changed the text accordingly

@yyx990803 yyx990803 merged commit 60fca98 into vitejs:main Jan 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants