@tamagui/build 1.91.5 → 1.92.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 +16 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/build",
3
- "version": "1.91.5",
3
+ "version": "1.92.1",
4
4
  "bin": {
5
5
  "tamagui-build": "tamagui-build.js"
6
6
  },
package/tamagui-build.js CHANGED
@@ -562,8 +562,23 @@ async function esbuildWriteIfChanged(
562
562
  }
563
563
 
564
564
  if (pkgRemoveSideEffects && isESM) {
565
+ const allowedSideEffects = pkg.sideEffects || []
566
+
567
+ const result = []
568
+ const lines = outString.split('\n')
569
+ for (const line of lines) {
570
+ if (
571
+ !line.startsWith('import ') ||
572
+ allowedSideEffects.some((allowed) => line.includes(allowed))
573
+ ) {
574
+ result.push(line)
575
+ continue
576
+ }
577
+ result.push(line.replace(/import "[^"]+";/g, ''))
578
+ }
579
+
565
580
  // match whitespace to preserve sourcemaps
566
- outString = outString.replace(/\nimport "[^"]+";\n/g, '\n\n')
581
+ outString = result.join('\n')
567
582
  }
568
583
 
569
584
  async function flush(contents, path) {