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

[Bug]: Missing "./dist/preview.js" export in "@storybook/nextjs" package #20348

Closed
jeremytenjo opened this issue Dec 20, 2022 · 6 comments
Closed

Comments

@jeremytenjo
Copy link

Describe the bug

Getting error when running sb dev

[plugin:vite:import-analysis] Missing "./dist/preview.js" export in "@storybook/nextjs" package
/virtual:/@storybook/builder-vite/vite-app.js

image

To Reproduce

Terminal did not accept my choice for `Would you like to use ESLint with this project? › No / Yes` so I added a testable repo :)

1. run `git clone https://github.com/jeremytenjo/starter-website --branch upgrade-to-storybook-7 && cd starter-website && npm i && npm run storybook:dev`

2. open `http://localhost:6006/?path=/story/pages--hello-from-figma`

System

Environment Info:

  System:
    OS: macOS 13.0.1
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm
  Browsers:
    Chrome: 108.0.5359.124
    Firefox: 95.0.2
  npmPackages:
    @storybook/addon-actions: 7.0.0-beta.13 => 7.0.0-beta.13 
    @storybook/addon-essentials: 7.0.0-beta.13 => 7.0.0-beta.13 
    @storybook/addon-interactions: 7.0.0-beta.13 => 7.0.0-beta.13 
    @storybook/addon-links: 7.0.0-beta.13 => 7.0.0-beta.13 
    @storybook/builder-vite: 7.0.0-beta.13 => 7.0.0-beta.13 
    @storybook/cli: 7.0.0-beta.13 => 7.0.0-beta.13 
    @storybook/nextjs: 7.0.0-beta.13 => 7.0.0-beta.13 
    @storybook/testing-library: 0.0.14-next.1 => 0.0.14-next.1

Additional context

"next": "13.0.7",
@sneko
Copy link

sneko commented Dec 21, 2022

@jeremytenjo also trying to use Vite as builder with the Next framework in beta v7. Interested by a workaround :) .

In the meantime what I see:

@9oelM
Copy link

9oelM commented Apr 18, 2023

Im having the same issue but I don't understand the error message. Can someone explain?

@jeremytenjo
Copy link
Author

@jeremytenjo also trying to use Vite as builder with the Next framework in beta v7. Interested by a workaround :) .

In the meantime what I see:

Thanks sneko, I ended up switching to the webpack v5 builder, it is more reliable than the vite builder.

@stuartjnelson
Copy link

I'm also getting the error;

Node: 16.14.2
Os: MacOs 10.14.6

"dependencies": {
  "@storybook/nextjs": "^7.0.5",
  "storybook": "^7.0.5"
},
"devDependencies": {
  "@storybook/builder-vite": "^7.0.6"
}

@LeandrodeLimaC
Copy link

The only way I managed to solve it was by updating Storybook to the new version.

First of all, I was using Node 16 and migrated to 18. With this, an error about legacy providers started to appear, and many people were recommending downgrading the Node version or using a flag to bypass it, but I didn't fall for it.

(Remember to save a commit of the project before doing this fix in case something goes wrong.)

So I went to the project's documentation package and ran an "npm audit fix --force". After that, I continued to have an error, so I ran an "npm update". This resulted in all my dependencies being updated, including Storybook.

In the new version of Storybook, we don't use the "start-storybook" command anymore... basically, if you run the command, it will say that it doesn't exist (link to the issue: #18923).

To continue with the migration, I ran "npx storybook@next automigrate". Storybook helped a lot with the migration, detecting everything that needed to change and asking if it could do it automatically. I accepted everything! Haha. It updated the script to run the project, and now everything is working fine!

@landsman
Copy link

I'm also getting the error;

"dependencies": {
    "next": "13.4.19",
},
"devDependencies": {
    "storybook": "^7.4.4",
    "@storybook/builder-vite": "^7.4.4",

    "@storybook/addon-essentials": "^7.4.4",
    "@storybook/addon-interactions": "^7.4.4",
    "@storybook/addon-links": "^7.4.4",
    "@storybook/addon-onboarding": "^1.0.8",
    "@storybook/blocks": "^7.4.4",
    "@storybook/builder-vite": "^7.4.4",
    "@storybook/nextjs": "^7.4.4",
    "@storybook/react": "^7.4.4",
    "@storybook/testing-library": "^0.2.1",
}

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

No branches or pull requests

8 participants