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

feat(astro) pass config to vite alias #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jonathantneal
Copy link

@jonathantneal jonathantneal commented Feb 28, 2023

Changes

This changes vite-plugin-config-alias so that its aliases are passed directly to Vite.

By passing aliases from jsconfig.json or tsconfig.json files directly into Vite’s built-in alias configuration, non-JS files like CSS can now aliases.

Testing

The current test for tsconfig.json only targets JS resolution, and so I’ve added a test for jsconfig.json that also target CSS resolution.

For an example of the issue, here is what current happens when an alias is used inside a CSS file:
https://stackblitz.com/edit/github-khftu4?file=src/pages/_index.css

For an example of the fix, here is what happens if we push the tsconfig to aliases instead:
https://stackblitz.com/edit/github-khftu4-d255tn?file=src/pages/_index.css

Docs

/cc @withastro/maintainers-docs for feedback!

@jonathantneal jonathantneal changed the title feature: pass tsconfig to vite alias feat(astro) pass tsconfig to vite alias Feb 28, 2023
@jonathantneal jonathantneal changed the title feat(astro) pass tsconfig to vite alias feat(astro) pass config to vite alias Feb 28, 2023
@jonathantneal
Copy link
Author

Would you be willing to review this, @bluwy?

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.

1 participant