Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find relative presets defined in .babelrc #2771

Closed
vjpr opened this issue Jan 18, 2018 · 8 comments
Closed

Cannot find relative presets defined in .babelrc #2771

vjpr opened this issue Jan 18, 2018 · 8 comments

Comments

@vjpr
Copy link

vjpr commented Jan 18, 2018

Issue details

ERROR in ./.storybook/addons.js
Module build failed: Error: Couldn't find preset "./packages/babel-preset-foo" relative to directory "/Users/Vaughan/dev-live/foo/.storybook"

Project tree:

- .babelrc
- packages
  - babel-preset-foo

.babelrc

{"presets": ["./packages/babel-preset-foo"]}

Please specify which version of Storybook and optionally any affected addons that you're running

    "@storybook/react": "^3.3.9",
    "@storybook/addon-actions": "^3.3.9",
    "@storybook/addon-links": "^3.3.9",
    "@storybook/addons": "^3.3.9"
@vjpr
Copy link
Author

vjpr commented Jan 18, 2018

Simple fix was to add a .babelrc file to .storybook/ and correct the relative preset path.

@vjpr vjpr closed this as completed Jan 18, 2018
@vjpr
Copy link
Author

vjpr commented Jan 18, 2018

This didn't actually solve my problem. It appears that babel tries to read relative presets from the dir of the file it is processing. So the preset path would need to be absolute, but this is not possible because .babelrc is static...

It's not happening with the rest of my app, so I am wondering if its a storybook config setting.

@vjpr vjpr reopened this Jan 18, 2018
@vjpr
Copy link
Author

vjpr commented Jan 18, 2018

Seems related to #172

I am using:

{
  "extends": "../.babelrc"
}

This resolves the errors for now.

@vjpr
Copy link
Author

vjpr commented Jan 18, 2018

The extends rewriting should also be added for presets and plugins perhaps:

https://github.com/storybooks/storybook/blob/83d55c23fa124fa87cd061bdb5b5ce9453b393c1/app/vue/src/server/babel_config.js#L58-L66

@Hypnosphi
Copy link
Member

Also related: #2610 #2582

@stale
Copy link

stale bot commented Mar 4, 2018

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 60 days. Thanks!

@stale stale bot added the inactive label Mar 4, 2018
@stale
Copy link

stale bot commented Mar 19, 2018

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

@Hypnosphi
Copy link
Member

Released as 4.0.0-alpha.20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants