-
Notifications
You must be signed in to change notification settings - Fork 27.1k
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
@next/plugin-storybook issues #19345
Comments
another issue is importing global css, which Next.js only allows in |
Note that there is a sister issue in Storybook, to track more broadly the potential inconsistencies: storybookjs/storybook#9610 |
I have the same issue that it can't resolve |
for the |
For follow-up, I successfully added support for CSS modules. (see storybookjs/storybook#9610 (comment)) See commit UnlyEd/next-right-now@777c3ce Storybook demo at https://nrn-v2-mst-aptd-at-lcz-sty-storybook.vercel.app/?path=/story/utilities-i18nlink--link-with-css-module If you want to experiment with the implementation, you can clone the branch:
|
I've finally cleaned up my open PR in favour of this one #23020 If merged, this will bring an official Storybook example that would include This work would also benefit any tool that want to make profit of the "Next.js magic" during build time (Cypress, Jest...). |
since recently, it seems this is also required in
- rewrites: [],
+ rewrites: { beforeFiles: [], afterFiles: [], fallback: [] }, |
This fixes a bug in `@next/plugin-storybook` caused by an update in the rewrite structure, solution was provided by @stefanprobst #19345 (comment) Secondary question: it would be awesome if someone at Next could help translating `preset.js` into TypeScript, this would catch those bugs immediately. I've tried in #18367 but failed to build correctly. ## Bug - [X] Related issues linked using `fixes #number` => parent issue is an umbrella of various small issues: #19345 - [X] Integration tests added => reproduction is implemented in https://github.com/lbke/next-plugin-storybook-demo until the package is more stable
This fixes a bug in `@next/plugin-storybook` caused by an update in the rewrite structure, solution was provided by @stefanprobst vercel#19345 (comment) Secondary question: it would be awesome if someone at Next could help translating `preset.js` into TypeScript, this would catch those bugs immediately. I've tried in vercel#18367 but failed to build correctly. ## Bug - [X] Related issues linked using `fixes #number` => parent issue is an umbrella of various small issues: vercel#19345 - [X] Integration tests added => reproduction is implemented in https://github.com/lbke/next-plugin-storybook-demo until the package is more stable
Closing as this experimental package is doom to fail in the way it is architectured (at the time of writing) because it uses the full Next.js webpack magic, instead we need to setup Storybook step by step. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
To Reproduce
I've done a separate basic app, in which I try to make Storybook work with ONLY @next/plugin-storybook, to check its limitations/bugs step by step:
https://github.com/lbke/next-plugin-storybook-demo
All instructions to debug locally are listed there
I am also testing in in Vulcan Next, which is a realistic install.
Also PR #18367 demos a minimal install + a TypeScript version (but the TypeScript build never worked).
Describe the bug
I track here issues encountered with
@next/plugin-storybook
, in order to provide 1st class Storybook support.TypeScript
d.ts
file that can be needed to add typings locallyVarious
@next/plugin-storybook
seems to have a hidden dependency toerror-loader
. What is the use of this loader? Edit: this issue has been mentioned here already: [@next/storybook] - incorrectly imported css throws an inaccurate error #15195. To sum it up this generic message is simply the sign that the build is not working as expected, and then the error can't be displayed correctly due to the lack oferror-loader
.React
is imported again in a component (Next has some magic soimport React from "react"
is optional, but Storybook doesn't).@next/plugin-storybook
should also include a decorator that loads the router in order to avoid any potential issues with components such as Link. The decorator proposed in this issue could also be exposed on its own, until we figure out all the plugin issue, so user can use just the decorator already.Issues with Webpack 5 update and conflicts
Cannot reuse Next.js bundled Webpack 5 version instead of the one installed by Storybook, which leads to duplication of Webpack and thus errors:
Expose Webpack bundle5 for development of external packages #25552
Doesn't build anymore,
chalk
seems to be hidden dependency but installing it doesn't solve the issue:This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
As far as I can tell the solution will be to
yarn link ./node_modules/webpack
in@next/plugin-storybook
=> Solved by using
yalc
for local development and linkingpackages/next-plugin-storybook
andpackages/next
from Next canary branchExpected behavior
The plugin works and handle
paths
aliases out of the box + some Next specific feature, like optionalimport React
.Expected minimum features:
The text was updated successfully, but these errors were encountered: