question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

native storybook unable to resolve babel aliases

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
alj1scommented, Nov 24, 2017

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:

module.exports = {
  getEnableBabelRCLookup() {
    return true;
  },
};

(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?

5reactions
alanbuenocommented, May 14, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found