Description
Context: I'm using Storybook for React Native Web and I need to transpile a node_modules dependency that uses reanimated.
When running the worklets Babel plugin through vite, via @rollup/plugin-babel (or rolldown), it may receive filenames with querystrings, such as ?v=123. This will cause the plugin to throw ENOENT when it tries to read the file to generate source maps:
|
fs.readFileSync(sourceFile).toString('utf-8') |
■ Vite Internal server error:
│ ./node_modules/.cache/storybook/10.3.6/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/heroui-native.js?v=b3c989f4:
│ [Worklets] Babel plugin exception: ENOENT: no such file or directory, open
│ './node_modules/.cache/storybook/10.3.6/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/heroui-native.js?v=b3c989f4'
│ Plugin: vite:react-babel
Steps to reproduce
- Clone this repository.
pnpm install
pnpm run storybook
Expected: Storybook runs without any errors.
Actual: ENOENT errors
Snack or a link to a repository
https://github.com/NiGhTTraX/sb-native-reanimated
Reanimated version
4.2.1
Worklets version
0.7.4
React Native version
0.83.6
Platforms
Web
JavaScript runtime
Hermes
Workflow
Expo Go
Architecture
New Architecture (Fabric renderer)
Reanimated feature flags
No
React Native release level
Stable
Build type
Debug app & dev bundle
Device
No response
Host machine
macOS
Device model
No response
Acknowledgements
Yes
Description
When running the worklets Babel plugin through vite, via
@rollup/plugin-babel(orrolldown), it may receive filenames with querystrings, such as?v=123. This will cause the plugin to throw ENOENT when it tries to read the file to generate source maps:react-native-reanimated/packages/react-native-worklets/plugin/src/workletStringCode.ts
Line 128 in e6a8526
Steps to reproduce
pnpm installpnpm run storybookExpected: Storybook runs without any errors.
Actual: ENOENT errors
Snack or a link to a repository
https://github.com/NiGhTTraX/sb-native-reanimated
Reanimated version
4.2.1
Worklets version
0.7.4
React Native version
0.83.6
Platforms
Web
JavaScript runtime
Hermes
Workflow
Expo Go
Architecture
New Architecture (Fabric renderer)
Reanimated feature flags
No
React Native release level
Stable
Build type
Debug app & dev bundle
Device
No response
Host machine
macOS
Device model
No response
Acknowledgements
Yes