Skip to content

Commit

Permalink
fix svelte-vite detection for NPM workspaces
Browse files Browse the repository at this point in the history
In monorepo, the framework name will be an absolute path.

A follow up for storybookjs#23458.
  • Loading branch information
legnaleurc committed Sep 7, 2023
1 parent 32e8c0b commit fd3cce9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/frameworks/svelte-vite/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ export async function handleSvelteKit(plugins: PluginOption[], options: Options)
'vite-plugin-sveltekit-setup',
'vite-plugin-sveltekit-compile',
]);
// The package name can be either "@storybook/sveltekit" or an absolute path in monorepo.
const packageRegex = /(^|\/node_modules\/)@storybook\/sveltekit$/;

if (hasSvelteKitPlugins && framework !== '@storybook/sveltekit') {
if (hasSvelteKitPlugins && packageRegex.test(framework)) {
throw new Error(dedent`
We've detected a SvelteKit project using the @storybook/svelte-vite framework, which is not supported in Storybook 7.0
Please use the @storybook/sveltekit framework instead.
Expand Down

0 comments on commit fd3cce9

Please sign in to comment.