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

Storybook fails to compile after upgrading Next.js to v6.0.3 #3624

Closed
sebastian-veggiani-globant opened this issue May 22, 2018 · 10 comments
Closed

Comments

@sebastian-veggiani-globant
Copy link

sebastian-veggiani-globant commented May 22, 2018

Storybook fails to compile after upgrading Next to v6.0.3

After upgrading Next.js to v6.0.3 my previously working setup stopped working.

The reported error is:

ERROR in ./.storybook/config.js
Module build failed: Error: Plugin 0 specified in "c:\\....\\node_modules\\next\\babel.js" provided an invalid property of "default" (While processing preset: "c:\\...\\node_modules\\next\\babel.js")

Steps to reproduce

Upgrade a Next project from v5.1 to v6.0.3.

UPDATE: downgrading to v5.1 fixes the problem.

Storybook versions

  • storybook/react 3.4.5
  • storybook/addon-info 3.4.5

.stoyboojk/config.js

import { configure } from '@storybook/react';
import '../src/styles/main.scss'

const req = require.context('../src', true, /stories\.js$/)

function loadStories() {
  req.keys().forEach(req)
}

configure(loadStories, module);
@sebastian-veggiani-globant sebastian-veggiani-globant changed the title Storybook fails to compile after upgrading Next to v6.0.3 Storybook fails to compile after upgrading Next.js to v6.0.3 May 22, 2018
@suphareuk
Copy link

I have same error with Next v6 too.
It look like Storybook has problem with root .babelrc
I fixed by provided a custom .babelrc in .storybook folder

@thulstrup
Copy link

thulstrup commented May 23, 2018

@suphareuk What's in your .babelrc in the .storybook folder?

@revolunet
Copy link

revolunet commented May 23, 2018

for me and its not working (same error) :

{
  "presets": ["next/babel"],
  "plugins": [
    "react-require"
  ]
}

@revolunet
Copy link

executing yarn just before npm run storybook solves it for me.

i'm using [email protected] and it breaks after each npm i so at the moment you have to use yarn for this

@sebastian-veggiani-globant
Copy link
Author

@revolunet using yarn here. running yarn before initializing storybook doesn't solve the problem for me...

@suphareuk
Copy link

suphareuk commented May 24, 2018

@thulstrup
This is my .babelrc setting in .storybook folder

{
  "presets": ["env", "stage-0", "react"]
}

I got the error when put only "next/babel" in presets.
Change to use other babel presets in .storybook folder work fine for me.

@thulstrup
Copy link

@suphareuk Thanks! That did the trick for me as well.

@revolunet
Copy link

revolunet commented May 25, 2018

Hi

I also had to add "plugins":["react-require"] for next.js

And for some reason this workaround doesnt work when you use next/dynamic in your project :

`next/dynamic` options should contain `modules` and `render` fields

Same error with 3.4.2 or 4.0.0-alpha.8

@stale
Copy link

stale bot commented Jun 18, 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 30 days. Thanks!

@stale
Copy link

stale bot commented Jul 18, 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!

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

6 participants