React Native Storybook doesn't work with current CRNA
See original GitHub issueThanks for this awesome tool 👍 Unfortunately, we ran into some issue while upgrading our app to Expo 20. Apparently, react-inspector causes it.
TL;DR: When using React Native Storybook within a CRNA (Expo 20), React Native packager throws TransformError during bundling:
TransformError: {appPath}/node_modules/react-inspector/lib/index.js: Couldn't find preset "es2015" relative to directory "{appPath}/node_modules/react-inspector"
Versions:
"expo": "20.1.3"
"react": "16.0.0-alpha.12"
"react-dom": "16.0.0-alpha.12"
"react-native": "0.47.2"
"react-native-scripts": "1.3.1"
"@storybook/react-native": "3.2.8"
Steps to reproduce:
- Create a new CRNA or clone sample repo https://github.com/inyono/crna-storybook-expo20:
create-react-native-appgetstorybook- Replace App.js with
export default from './storybook';
yarnresp.npm install- Start React Native packager with
yarn startresp.npm start - Open app in Expo
- Error in terminal:
Failed building JavaScript bundle - Error on device / simulator:
TransformError: {appPath}/node_modules/react-inspector/lib/index.js: Couldn't find preset "es2015" relative to directory "{appPath}/node_modules/react-inspector"
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Using Storybook with React Native - Pusher
Start by installing Create React Native App (CRNA). We'll be using it to generate a new React Native project that works with Storybook:...
Read more >storybook/addon-ondevice-knobs
Storybook on react native is a normal React Native component that can be used or hidden anywhere in your RN application based on...
Read more >@storybook/react-native-server | Yarn - Package Manager
A better way to develop React Native Components for your app ... With Storybook for React Native you can design and develop individual...
Read more >react-native-hybrid-storybook - npm package | Snyk
The current version is using latest react-native-web (of version ^0.9.0 ). It's compatible (with exsiting working examples) with Expo SDK 30 (using react-native...
Read more >@storybook/react-native - npm
Start using @storybook/react-native in your project by running `npm i ... Addon-info - Fix immutable props issues with React 16 #1894 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Hashnode Post
No results found

Fixed by: npm install --save-dev babel-preset-es2015
Then add .babelrc file to storybook folder with the es2015 in presets.
Screenshot: https://gyazo.com/2e7b0214dc9f217391b242f4b045807d
Until #1888 gets released and merged, the easiest fix for current apps is following:
@storybook/*dependenciesnpm installoryarn installdepending on which lockfile do you use. This will remove the lock forreact-inspectorpackage