Open tomrob270 opened 2 months ago
Could you please provide a minimal reproduction In particular, test if one of the plugins are creating the issue. As a workaround, you may try to add jsdoc-type-pratt-parser to optimizeDeps.include
.
This appears to be introduced with 8.3.x in @storybook/core. This is not shown in the online examples linked to StackBlitz from the website. Those examples are currently experiencing a 404 bug looking for /sb-preview/runtime.js.
The workaround provided above for optimizeDeps.include
does fix the problem.
I got the same error; but the workaround does not work for me. I put jsdoc-type-pratt-parser
to optimizeDeps.include
within .storybook/main.ts
, but then it show the same error with vue itself:
The requested module '/node_modules/vue/dist/vue.runtime.esm-bundler.js?v=89f1e65f' does not provide an export named 'useId'
package.json:
"devDependencies": {
"@graphql-codegen/cli": "^5.0.2",
"@graphql-codegen/near-operation-file-preset": "^3.0.0",
"@graphql-codegen/typed-document-node": "^5.0.6",
"@graphql-codegen/typescript": "^4.0.6",
"@graphql-codegen/typescript-operations": "^4.2.0",
"@nuxt/eslint": "^0.5.0",
"@nuxt/eslint-config": "^0.5.0",
"@nuxt/icon": "^1.2.1",
"@nuxt/test-utils": "^3.13.1",
"@nuxtjs/i18n": "8.5.2",
"@nuxtjs/storybook": "~8.2.0",
"@pinia/nuxt": "^0.5.1",
"@storybook-vue/nuxt": "~8.2.0",
"@storybook/addon-a11y": "~8.3.0",
"@storybook/addon-essentials": "~8.3.0",
"@storybook/addon-interactions": "~8.3.0",
"@storybook/addon-links": "~8.3.0",
"@storybook/blocks": "~8.3.0",
"@storybook/test": "~8.3.0",
"@types/node": "^20.0.0",
"@urql/vue": "^1.3.2",
"@vue/test-utils": "^2.4.6",
"@vuepic/vue-datepicker": "^9.0.0",
"@vueuse/core": "^11.0.0",
"@vueuse/nuxt": "^11.0.0",
"@vueuse/router": "^11.0.0",
"dayjs-nuxt": "^2.1.9",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"happy-dom": "14.12.3",
"husky": "^9.1.4",
"lint-staged": "^15.2.7",
"nuxt": "3.13.1",
"nuxt-swiper": "^1.2.2",
"pinia": "^2.1.7",
"playwright-core": "^1.45.0",
"prettier": "^3.3.3",
"sass": "^1.78.0",
"storybook": "~8.3.0",
"typescript": "^4.9.3",
"venobox": "^2.1.8",
"vitest": "^1.6.0"
},
.storybook/main.ts
import type { StorybookConfig } from '@storybook-vue/nuxt';
import { mergeConfig } from 'vite';
const config: StorybookConfig = {
core: {
disableTelemetry: true,
},
stories: ['../components/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-a11y',
],
framework: {
name: '@storybook-vue/nuxt',
options: {},
},
staticDirs: [{ from: '../public/assets', to: 'assets' }],
async viteFinal(config) {
return mergeConfig(config, {
optimizeDeps: {
include: ['jsdoc-type-pratt-parser'],
}
});
}
};
export default config;
Not sure if it'll make a difference @cheindl but try adding optimizeDeps.include: ['jsdoc-type-pratt-parser']
into nuxt.config.ts
https://nuxt.com/docs/api/nuxt-config#vite
Could you please provide a minimal reproduction In particular, test if one of the plugins are creating the issue. As a workaround, you may try to add jsdoc-type-pratt-parser to
optimizeDeps.include
.
This fixes the error
Let's try to find a proper solution for this (which might be that we always add the optimizeDeps
entry in the module).
First, it would be good to know with which storybook version this occurs first. Is it 8.3.0 or 8.3.1? In the latter case, this might be triggered by https://github.com/storybookjs/storybook/pull/29134
Let's try to find a proper solution for this (which might be that we always add the
optimizeDeps
entry in the module).First, it would be good to know with which storybook version this occurs first. Is it 8.3.0 or 8.3.1? In the latter case, this might be triggered by storybookjs/storybook#29134
Also getting the same issue its a pretty new setup literally just been installing modules
Heres the current packag.json:
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@nuxt/fonts": "^0.8.0",
"@nuxt/image": "^1.8.0",
"@nuxtjs/seo": "^2.0.0-rc.21",
"@nuxtjs/storybook": "^8.2.0",
"nuxt": "^3.13.2",
"sass": "^1.79.3",
"vue": "^3.5.8",
"vue-router": "^4.4.5"
}
}
I could now reproduce it in the upgrade PR to v. 8.3.2 https://github.com/nuxt-modules/storybook/pull/779, but storybook v 8.3.0 works. So either add the optimizeDep for now (until its fixed upstream with https://github.com/storybookjs/storybook/pull/29179) or force all storybook deps to be v8.3.0.
Here's a repro with storybook@next, @storybook-vue/nuxt@nightly and @nuxtjs/storybook@nightly https://stackblitz.com/edit/nuxt-starter-vwzpyp?file=README.md,package.json
Thanks @fdendorfer, but this still uses the old version '@storybook/builder-vite': 8.3.3(storybook@8.3.3)(typescript@5.6.2)(vite@5.4.8)
without the fix. We have to wait for the release of storybook 8.4, and then use the updated version here in the module.
Until then use the workaround from https://github.com/nuxt-modules/storybook/issues/776#issuecomment-2360419016.
I'll pin this issue until its fixed.
The optimizeDeps.include
workaround doesn't work for us (v8.3.x
and v8.4.0-alpha
), but disabling the @storybook/addon-docs
included by @storybook/addon-essentials
did the trick:
// main.js
const config = {
// ...
addons: [
// ...
{
name: '@storybook/addon-essentials',
options: {
// fix jsdoc-type-pratt-parser
docs: false,
}
},
],
};
Somehow, I needed to include jsdoc-type-prat-parser
like below.
(I'm using pnpm btw)
vite: {
optimizeDeps: {
include: ['storybook > @storybook/core > jsdoc-type-pratt-parser'],
},
},
https://github.com/vitejs/vite/issues/10047 https://vite.dev/config/dep-optimization-options.html#optimizedeps-exclude
@yshrsmz can confirm that works for me, however when storybook loads up in parallel with the pnpm dev command, i get a Pre-transform error: Failed to resolve import "/_nuxt/@vite-plugin-checker-runtime" from "virtual:@vite-plugin-checker-runtime-entry". Does the file exist?
error. If i just use pnpm storybook, no error.
__
Somehow, I needed to include
jsdoc-type-prat-parser
like below. (I'm using pnpm btw)vite: { optimizeDeps: { include: ['storybook > @storybook/core > jsdoc-type-pratt-parser'], }, },
vitejs/vite#10047 https://vite.dev/config/dep-optimization-options.html#optimizedeps-exclude
Nice! This worked for me. Storybook runs now (Docker // PNPM // Nuxt 3:latest)
It seems some style are broken. Have to check this one
nuxt-ds | [nuxt:storybook:build] ERROR Context conflict
nuxt-ds |
nuxt-ds | at checkConflict (node_modules/.pnpm/nuxi@3.15.0/node_modules/nuxi/dist/shared/nuxi.f56b6a0d.mjs:43:13)
nuxt-ds | at Object.set (node_modules/.pnpm/nuxi@3.15.0/node_modules/nuxi/dist/shared/nuxi.f56b6a0d.mjs:77:9)
nuxt-ds | at initNuxt (node_modules/.pnpm/nuxt@3.14.0_@parcel+watcher@2.5.0_@types+node@18.19.64_ioredis@5.4.1_magicast@0.3.5_rollup@4._nz5a4uegooluwfsvugnjrc2mfa/node_modules/nuxt/dist/index.mjs:4375:11)
nuxt-ds | at Object.ready (node_modules/.pnpm/nuxt@3.14.0_@parcel+watcher@2.5.0_@types+node@18.19.64_ioredis@5.4.1_magicast@0.3.5_rollup@4._nz5a4uegooluwfsvugnjrc2mfa/node_modules/nuxt/dist/index.mjs:4277:18)
nuxt-ds | at defineNuxtConfig (node_modules/.pnpm/@storybook-vue+nuxt@0.2.6_@types+node@18.19.64_magicast@0.3.5_nuxt@3.14.0_@parcel+watcher@2.5_ro5oi4fjbgm4zgqkkunrccyht4/node_modules/@storybook-vue/nuxt/dist/preset.cjs:6744:14)
nuxt-ds | at async Object.viteFinal (node_modules/.pnpm/@storybook-vue+nuxt@0.2.6_@types+node@18.19.64_magicast@0.3.5_nuxt@3.14.0_@parcel+watcher@2.5_ro5oi4fjbgm4zgqkkunrccyht4/node_modules/@storybook-vue/nuxt/dist/preset.cjs:6773:22)
nuxt-ds | at async createViteServer (node_modules/.pnpm/@storybook+builder-vite@8.4.2_storybook@8.4.2_prettier@3.3.3__vite@5.4.10_@types+node@18.19.6_hw2nzfy3in3jtgyk5soopfhe7e/node_modules/@storybook/builder-vite/dist/index.js:69:3611)
nuxt-ds | at async Module.start (node_modules/.pnpm/@storybook+builder-vite@8.4.2_storybook@8.4.2_prettier@3.3.3__vite@5.4.10_@types+node@18.19.6_hw2nzfy3in3jtgyk5soopfhe7e/node_modules/@storybook/builder-vite/dist/index.js:69:4465)
nuxt-ds | at async storybookDevServer (node_modules/.pnpm/@storybook+core@8.4.2_prettier@3.3.3/node_modules/@storybook/core/dist/core-server/index.js:36065:11)
nuxt-ds | at async buildOrThrow (node_modules/.pnpm/@storybook+core@8.4.2_prettier@3.3.3/node_modules/@storybook/core/dist/core-server/index.js:35039:12)
nuxt-ds |
nuxt-ds |
nuxt-ds | [nuxt:storybook:build] WARN
nuxt-ds | Broken build, fix the error above.
nuxt-ds | You may need to refresh the browser.
nuxt-ds |
nuxt-ds |
? Would you like to help improve Storybook by sending anonymous crash reports? › (Y/n) ➜ DevTools: press Shift + Alt + D in the browser (v1.6.0)
nuxt-ds |
nuxt-ds | ✔ Vite client built in 178ms
nuxt-ds | ✔ Vite server built in 621ms
nuxt-ds | [nitro] ✔ Nuxt Nitro server built in 608 ms
nuxt-ds | ℹ Vite client warmed up in 2ms
nuxt-ds | ℹ Vite server warmed up in 904ms
Happens for me with latest nuxt & vue, someone here with similar behaviour?
👋 Hey there, fellow travelers of the package dependency maze!
So I stumbled upon this issue, and it seems like the command's adding extra packages by default? Or maybe it's just having some fun with us. 🤷♂️ Anyway, I thought I'd drop in a little something for all the lost souls who might land here, wondering why things aren’t working as expected.
Turns out, the commented fix below isn't even necessary. Yep, that's right.
import type { StorybookConfig } from "@storybook-vue/nuxt";
const config: StorybookConfig = {
stories: [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)",
"../stories/components/**/*.stories.@(js|jsx|mjs|ts|tsx|mdx)",
"../stories/patterns/**/*.stories.@(js|jsx|mjs|ts|tsx|mdx)",
"../stories/patterns/**/**/*.stories.@(js|jsx|mjs|ts|tsx|mdx)"
],
addons: [
"@storybook/addon-links",
"@storybook/addon-interactions",
"@storybook/addon-essentials",
],
framework: {
name: "@storybook-vue/nuxt",
options: {},
},
docs: {
autodocs: "tag",
},
// @ts-ignore
vite: {
// plugins: [],
// fix below is not needed
/*optimizeDeps: {
include: ['storybook > @storybook/core > jsdoc-type-pratt-parser'],
},*/
},
};
export default config;
For your sanity, here’s the correct package.json
setup for the latest Nuxt/Storybook adventure
"dependencies": {
"nuxt": "latest",
"vue": "latest",
"vue-router": "latest"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.9.0",
"@nuxtjs/storybook": "latest",
"@storybook-vue/nuxt": "latest",
"@storybook/addon-essentials": "8.4.2",
"@storybook/addon-links": "8.4.2",
"@storybook/addon-interactions": "8.4.2",
"@storybook/addon-mdx-gfm": "8.4.2",
"@storybook/blocks": "8.4.2",
"@storybook/test": "8.4.2",
"@types/node": "^18.17.5",
"storybook": "8.4.2",
},
This should hopefully make things smoother for the next traveler passing by. Safe coding, and may your package-lock.json
always be in sync! 🚀
@lafllamme does this work for you when running only nuxt dev
and does it show up under your nuxt devtools? I haven't been able to get it to show on the devtools plus it doesn't seem to be registering the /_storybook
route correctly 🤔
Hi @hacknug,
Regarding your first question: Yes, when I run nuxt dev
, everything works normally. I tested it with both (p)npm,
and it worked fine. I haven’t tried Bun yet, as I’ve encountered inconsistencies with various packages and (sub)modules, so I decided to skip it for now.
I managed to configure my Vite setup to connect with Nuxt DevTools, but it didn’t work as expected. While I could see modules, tools, settings, and imported composables, I couldn’t view my Storybook components, routes, or similar items.
If you’re interested, I can share my configuration for you to explore. Perhaps you might notice something I missed. I also created a bug ticket for this, as it seems related to the @nuxt/devtools
dev dependency.
Let me know if you want to collaborate on this further!
Best regards
Thank you @lafllamme for guiding us on this journey! However, even though I've followed your package.json to the point, it wasn't the solution. Storybook starts up and than crashed with the error: ✘ [ERROR] The entry point "vue" cannot be marked as external
.
We've been waiting for months in the hope this package gets fixed with no success so far. :(
Getting above error when adding storybook. It is correctly picking up .stories.ts files
.storybook/main
nuxt config
package.json