Skip to content

feat(astro) pass config to vite alias#2

Open
jonathantneal wants to merge 1 commit intomainfrom
jn.improve-config-alias
Open

feat(astro) pass config to vite alias#2
jonathantneal wants to merge 1 commit intomainfrom
jn.improve-config-alias

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 jonathantneal force-pushed the jn.improve-config-alias branch from a20f01f to 03ce722 Compare March 1, 2023 03:13
@jonathantneal jonathantneal force-pushed the jn.improve-config-alias branch from 03ce722 to 2f4259e Compare March 1, 2023 03:15
@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