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

vite: allow passing overrides for vite config #1444

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

Conversation

XiNiHa
Copy link

@XiNiHa XiNiHa commented Jul 7, 2024

Adds viteConfigOverrides option to the Vite plugin.
This option works as an escape hatch for users to deal with incompatibilities between their config and the VE Vite plugin.

Copy link

changeset-bot bot commented Jul 7, 2024

🦋 Changeset detected

Latest commit: a7c1cc0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@vanilla-extract/vite-plugin Minor
@vanilla-extract-private/test-helpers Patch
@vanilla-extract-private/tests Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@XiNiHa XiNiHa force-pushed the feat/vite-config-override branch from 8501f33 to a7c1cc0 Compare July 7, 2024 15:46
@askoufis
Copy link
Contributor

I'd like to understand what problem this is actually solving for you before considering whether this feature should be added. The vite plugin already loads your existing vite config when creating the compiler - see here - so anything you want to override could instead just be done in your own vite config, instead of by the plugin.

@XiNiHa
Copy link
Author

XiNiHa commented Jul 12, 2024

I want to actually "override" the config so have a separate config for running VE transforms, not just inheriting the primary config.

My usecase is kinda tricky. The Solid Vite plugin emits browser-only code if it's not an SSR build, which breaks VE evaluator to break. However since VE Vite plugin just takes my Vite config and runs transform with it, it's impossible to prevent Solid Vite plugin from emitting those code.

While this specific usecase can be fixed by filtering out the Solid Vite plugin (like what we're already doing with the Remix plugin) issues like this will always come up as the target environment between Vite and VE Vite plugin will be always different (unless it's a SSR build) Therefore having an escape hatch will be valuable enough to let users workaround their issues.

@riccardoperra
Copy link
Contributor

@XiNiHa did you found a solution to get solid work with vanilla extract?

@XiNiHa
Copy link
Author

XiNiHa commented Oct 26, 2024

@XiNiHa did you found a solution to get solid work with vanilla extract?

I just yarn patched it 😅

https://github.com/contentstech-com/stackflow/blob/feat%2Fsolid-integration/.yarn%2Fpatches%2F%40vanilla-extract-vite-plugin-npm-4.0.12-ed14a9ba3b.patch

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.

3 participants