What happened?
When exporting the JS bundle Expo 55 builds fail if tree shaking is enabled, refer to: https://docs.expo.dev/guides/tree-shaking/
In other words when setting the following 2 environment variables:
EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH=1 EXPO_UNSTABLE_TREE_SHAKING=1
We get the following error:
Failed to generate Hermes bytecode for: /Users/brian/Main/Repos/min-repro-uniwind/node_modules/expo-router/entry.js
/var/folders/kp/nztmcczn5yz24k6mkw358kd00000gp/T/expo-bundler-0.9447713334643474-1776695548458/index.js:76766:1: error: 'import' statement requires module mode
import { Uniwind } from 'uniwind';
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: /Users/brian/Main/Repos/min-repro-uniwind/node_modules/hermes-compiler/hermesc/osx-bin/hermesc -emit-binary -out /var/folders/kp/nztmcczn5yz24k6mkw358kd00000gp/T/expo-bundler-0.9447713334643474-1776695548458/index.hbc /var/folders/kp/nztmcczn5yz24k6mkw358kd00000gp/T/expo-bundler-0.9447713334643474-1776695548458/index.js -O exited with non-zero code: 2
We would expect uniwind to not cause a failure in this case, when tree shaking is disabled the build succeeds.
Steps to Reproduce
- Clone reproducible repo
- Install packages via
bun i
- Run a JS bundle export step via with tree shaking enabled
EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH=1 EXPO_UNSTABLE_TREE_SHAKING=1 npx expo export --platform android
- See failure
Snack or Repository Link
https://github.com/brianangulo/min-repro-uniwind
Uniwind version
1.6.2
React Native Version
0.83.2
Platforms
Android, iOS
Expo
Yes
Additional information
What happened?
When exporting the JS bundle Expo 55 builds fail if tree shaking is enabled, refer to: https://docs.expo.dev/guides/tree-shaking/
In other words when setting the following 2 environment variables:
EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH=1 EXPO_UNSTABLE_TREE_SHAKING=1We get the following error:
Failed to generate Hermes bytecode for: /Users/brian/Main/Repos/min-repro-uniwind/node_modules/expo-router/entry.js
/var/folders/kp/nztmcczn5yz24k6mkw358kd00000gp/T/expo-bundler-0.9447713334643474-1776695548458/index.js:76766:1: error: 'import' statement requires module mode
import { Uniwind } from 'uniwind';
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: /Users/brian/Main/Repos/min-repro-uniwind/node_modules/hermes-compiler/hermesc/osx-bin/hermesc -emit-binary -out /var/folders/kp/nztmcczn5yz24k6mkw358kd00000gp/T/expo-bundler-0.9447713334643474-1776695548458/index.hbc /var/folders/kp/nztmcczn5yz24k6mkw358kd00000gp/T/expo-bundler-0.9447713334643474-1776695548458/index.js -O exited with non-zero code: 2
We would expect uniwind to not cause a failure in this case, when tree shaking is disabled the build succeeds.
Steps to Reproduce
bun iEXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH=1 EXPO_UNSTABLE_TREE_SHAKING=1 npx expo export --platform androidSnack or Repository Link
https://github.com/brianangulo/min-repro-uniwind
Uniwind version
1.6.2
React Native Version
0.83.2
Platforms
Android, iOS
Expo
Yes
Additional information