@tamagui/build 1.75.3 → 1.75.5

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 +21 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/build",
3
- "version": "1.75.3",
3
+ "version": "1.75.5",
4
4
  "bin": {
5
5
  "tamagui-build": "tamagui-build.js"
6
6
  },
package/tamagui-build.js CHANGED
@@ -385,7 +385,7 @@ async function esbuildWriteIfChanged(
385
385
  if (!shouldWatch && !platform) {
386
386
  return await esbuild.build(opts)
387
387
  }
388
-
388
+
389
389
  const built = await esbuild.build({
390
390
  ...opts,
391
391
 
@@ -406,7 +406,7 @@ async function esbuildWriteIfChanged(
406
406
  // })
407
407
  // },
408
408
  // },
409
- ],
409
+ ].filter(Boolean),
410
410
 
411
411
  treeShaking: true,
412
412
  minifySyntax: true,
@@ -489,7 +489,14 @@ async function esbuildWriteIfChanged(
489
489
  const outDir = dirname(outPath)
490
490
 
491
491
  await fs.ensureDir(outDir)
492
- const outString = new TextDecoder().decode(file.contents)
492
+ let outString = new TextDecoder().decode(file.contents)
493
+
494
+ if (platform === 'web') {
495
+ const rnWebReplacer = replaceRNWeb[opts.format]
496
+ if (rnWebReplacer) {
497
+ outString = outString.replaceAll(rnWebReplacer.from, rnWebReplacer.to)
498
+ }
499
+ }
493
500
 
494
501
  if (shouldWatch) {
495
502
  if (
@@ -504,3 +511,14 @@ async function esbuildWriteIfChanged(
504
511
  })
505
512
  )
506
513
  }
514
+
515
+ const replaceRNWeb = {
516
+ esm: {
517
+ from: 'from "react-native"',
518
+ to: 'from "react-native-web"'
519
+ },
520
+ cjs: {
521
+ from: 'require("react-native")',
522
+ to: 'require("react-native-web")'
523
+ }
524
+ }