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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
poc: Fix Basic Vite Support #2286
Conversation
@bnussman is attempting to deploy a commit to the Tamagui Team on Vercel. A member of the Team first needs to authorize it. |
New dependencies detected. Learn more about Socket for GitHub 鈫楋笌
|
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
define: { | ||
'process.env.TAMAGUI_BAIL_AFTER_SCANNING_X_CSS_RULES': false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somethig is going to have to be done with process.env.TAMAGUI_BAIL_AFTER_SCANNING_X_CSS_RULES
in insetStyleRule.tsx
. This won't work in the browser
I tried removing it but that package would break when it was rebuilt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what to do about import.meta.env. Webpack doesn't support it:
So you're sort of stuck. It's actually a bit wild that we have the two most popular bundlers set up in a way that you can't really access env without some really weird hacks.
I think I've done something like typeof import.meta !== 'undefined' ? import.meta.env.X : process.env.X
before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solved the main problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The react plugin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My goal was to see what it would take to tamagui without any plugins.
These changes in this file allowed me to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created this vite
app just for testing.
Merged on another branch :) |
Description 馃摑
This is a POC that shows how
@tamagui/config/v3
is broken for ViteThe main two issues with basic Vite support are
process.env.TAMAGUI_BAIL_AFTER_SCANNING_X_CSS_RULES
makes Vite dev mode not work@tamagui/config/v3
exports react native code I think?Before
After
Screencast.from.02-17-2024.11.41.30.AM.webm