-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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]: __dirname is not defined
error while running vitest with storybook 8.3 integrated with sveltekit and vitest addon
#29151
Comments
Thanks for the report! After investigating it, @valentinpalkovic and I have a few pointers:
We then ran into a bunch of general Vitest Browser Mode - SvelteKit - Svelte 5 issues that seems to be unrelated to Storybook but more a general issue with their integration. This is a bit strange because we have this working in our CI, but I can't get a regular Vitest Browser + SvelteKit + Svelte 5 setup working at all, I'll have to investigate that further. As a side-note, |
My bad. Not sure why that got missed out. Here's the revised link where it should reproduce the
Got it. I have filed the feature request on the |
I can confirm that issue and would love to see #29157 merged to get that resolved. Thx and love to all who are putting efforts into this! <3 A quickfix to solve this issue in the meantime can be achieved like this: export const storybookSveltekitPlugin = () => {
return [
{
name: "storybook:sveltekit-mock-stores",
config: () => ({
resolve: {
alias: {
"$app/forms": resolve(
".",
"node_modules/@storybook/sveltekit/src/mocks/app/forms.ts",
),
"$app/navigation": resolve(
".",
"node_modules/@storybook/sveltekit/src/mocks/app/navigation.ts",
),
"$app/stores": resolve(
".",
"node_modules/@storybook/sveltekit/src/mocks/app/stores.ts",
),
},
},
}),
} satisfies Plugin,
];
}; |
I'm getting that in a different place. Why would a
|
Describe the bug
While running vitest with storybook 8.3 integrated with sveltekit, addon-svelte-csf and experiemental-vitest-addon, following error is thrown
This appears to be due to
commonjs
andesm
inter-operatability.Reproduction link
https://stackblitz.com/edit/sveltejs-kit-template-default-9enxbt?file=.storybook%2Fmain.js
Reproduction steps
pnpm install
svelte-kit sync
to generate.svelte-kit
folderpnpm start
- this should successfully run storybookvitest
- this should throw the errorSystem
Additional context
Since this is the first time I am trying this new experimental setup. I may have missed required steps. I have taken help from the official docs for this setup.
The text was updated successfully, but these errors were encountered: