Thanks 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-react-native-appgetstorybookexport default from './storybook';yarn resp. npm installyarn start resp. npm startFailed building JavaScript bundleTransformError: {appPath}/node_modules/react-inspector/lib/index.js: Couldn't find preset "es2015" relative to directory "{appPath}/node_modules/react-inspector"
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
@inspireui Thanks, nice workaround. I modified the .babelrc in root, didn't think about creating one in storybook directory. 馃槄
It looks like our move from babel es-2015 to env caused some unexpected packages to break.
Does someone want to submit a PR for this? a custom .babelrc is definitely not the solution if CRNA doesn't work out of the box.
@danielduan this has been fixed upstream
I guess updating the dependency of react-inspector will close this issue?
@Ragnar-H I don't see react-inspector listed explicitly as a dependency so I'm guessing the fix would just be to delete the node_modules and reinstall?
I would consider this case closed if that's the solution.
@danielduan it's a dependency of @storybook/ui (see lib/ui/package.json). I'll try to update it
@Hypnosphi it's also in addon-actions - addons/actions/package.json
@danielduan you'd also need to clear the dependency from yarn.lock
Until #1888 gets released and merged, the easiest fix for current apps is following:
@storybook/* dependenciesnpm install or yarn install depending on which lockfile do you use. This will remove the lock for react-inspector package
Most helpful comment
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