fix(vxrn): inject TAMAGUI_TARGET into native rolldown bundle defines#714
Merged
Conversation
import.meta.env.TAMAGUI_TARGET resolved to '' in prod rolldown native builds because the shared native define-builder omitted it (metro's platformEnv had it, rolldown didn't). Adds TAMAGUI_TARGET + import.meta TAMAGUI_ENVIRONMENT to match metro parity, plus a regression test. Fixes Native iOS Tests (prod, rolldown) import-meta-env failure.
|
🚅 Deployed to the one-pr-714 environment in onestack.dev
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Native iOS Tests (prod, rolldown)fails on main:The test page reads
import.meta.env.TAMAGUI_TARGETdirectly. In the rolldown native build that identifier was never defined, so it resolved to''. The metro variants passed because metro'sgetPlatformEnvDefine(vite-plugin-metro/src/env/platformEnv.ts) injects the fullPlatformEnvset — includingTAMAGUI_TARGET: 'native'.The shared rolldown native define-builder (
getNativeTransformConfiginvxrn/src/utils/createNativeDevEngine.ts, used by both the dev engine and prodbuildNativeBundle) injectedVITE_ENVIRONMENT/VITE_NATIVE/EXPO_OSandprocess.env.TAMAGUI_ENVIRONMENT, but omittedTAMAGUI_TARGETentirely (bothprocess.env.*andimport.meta.env.*, and from the whole-objectimport.meta.envdefine).Fix
Add to the native define-builder, matching metro parity (native →
TAMAGUI_TARGET: 'native',TAMAGUI_ENVIRONMENT: platform):envObject:TAMAGUI_TARGET,TAMAGUI_ENVIRONMENTprocess.env.TAMAGUI_TARGETimport.meta.env.TAMAGUI_TARGET,import.meta.env.TAMAGUI_ENVIRONMENTVerification
createNativeDevEngine.test.ts(ios/android × dev/prod) asserting the defines — passes, and fails without the change (keys absent).