native storybook unable to resolve babel aliases
See original GitHub issueI had a working storybook that broke when upgrading to RN 0.50. It can no longer resolve the babel aliases. The package was created with react-native init
RN: 0.50.3 Storybook: 3.2.16
My babelrc:
{
"presets": ["flow", "react-native"],
"plugins": [
["babel-plugin-module-resolver", {
"root": ["."],
"alias": {
"crypto": "./src/polyfills/modules/crypto/index.js",
"xenon": "./src"
}
}]
],
"env": {
"test": {
},
},
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Native storybook unable to resolve babel aliases #5201 - GitHub
Describe the bug. I'm getting the same error as #2362. Module @components does not exist in the Haste module map.
Read more >How to resolve aliases in Storybook? - Stack Overflow
Storybook works great, but as soon as I start importing files with aliases, it crashes. The app works fine with the aliases.
Read more >How to resolve a path alias in Storybook - +return
To solve this issue, we will need to configure Storybook's webpack to resolve the path alias. the concept is really similar to how...
Read more >Webpack - Storybook
When working with TypeScript projects, the default Webpack configuration may fail to resolve module aliases defined in your tsconfig file.
Read more >Unable to resolve module when building react-native .apk ...
Coding example for the question Unable to resolve module when building react-native .apk, babel-plugin-module-resolver aliases-babel.js.
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 Dev.to Post
No results found
Top Related Hashnode Post
No results found
Looks to be due to a breaking change in RN 0.50. See https://github.com/facebook/react-native/commit/023ac57337b351959d443133c3c09607c4ffc800
Can be resolved by creating a
rn-cli.config.js
file with the following contents:(taken from https://github.com/facebook/react-native/releases/tag/v0.50.0)
I’ve not looked in to how storybook resolves references, is this approach just a workaround or the best way forward?
any news regarding this one? same thing here, app works fine but when running storybook babel’s not able to resolve any alias while pointing the --projectRoot storybook instead of replacing the app entry point