@tamagui/build 3.0.0-beta.765.1 → 3.0.0-beta.804.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tamagui-build.js +14 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/build",
3
- "version": "3.0.0-beta.765.1",
3
+ "version": "3.0.0-beta.804.1",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "files": [
6
6
  "babel-plugin-process-env-to-meta.js",
package/tamagui-build.js CHANGED
@@ -483,6 +483,11 @@ const shouldSkipTypes = shouldSwapExports
483
483
  : !!(hasFlag('--skip-types') || process.env.SKIP_TYPES)
484
484
 
485
485
  const shouldSkipNative = hasFlag('--skip-native')
486
+ // a package that hosts both platforms at runtime (the compiler evaluates
487
+ // modules per-platform and saves/restores process.env.TAMAGUI_TARGET) must
488
+ // keep its env reads live: inlining them turns its save/restore into an
489
+ // unconditional env flip
490
+ const shouldSkipTargetDCE = hasFlag('--keep-env-target')
486
491
  const shouldSkipMJS = hasFlag('--skip-mjs')
487
492
  const shouldSkipSourceMaps =
488
493
  hasFlag('--skip-sourcemaps') || getEnvFlag('TAMAGUI_BUILD_SKIP_SOURCEMAPS')
@@ -1513,12 +1518,15 @@ async function esbuildWriteIfChanged(
1513
1518
  }
1514
1519
 
1515
1520
  if (!isMap && path.endsWith('.js')) {
1516
- const hadTamaguiTarget = contents.includes('process.env.TAMAGUI_TARGET')
1517
- contents = dceTamaguiTarget(contents, {
1518
- format: opts.format,
1519
- jsx: opts.jsx,
1520
- platform,
1521
- })
1521
+ const hadTamaguiTarget =
1522
+ !shouldSkipTargetDCE && contents.includes('process.env.TAMAGUI_TARGET')
1523
+ if (!shouldSkipTargetDCE) {
1524
+ contents = dceTamaguiTarget(contents, {
1525
+ format: opts.format,
1526
+ jsx: opts.jsx,
1527
+ platform,
1528
+ })
1529
+ }
1522
1530
 
1523
1531
  if (isESM && hadTamaguiTarget) {
1524
1532
  contents = await pruneUnusedImports(contents, path)