Skip to content

Commit

Permalink
Merge branch 'next' into 20780-unattached-source-code
Browse files Browse the repository at this point in the history
  • Loading branch information
JReinhold authored Jan 27, 2023
2 parents 48dfc5d + 62ebc82 commit 3ef1144
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
15 changes: 15 additions & 0 deletions code/frameworks/sveltekit/src/plugins/config-overrides.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Plugin } from 'vite';

export function configOverrides() {
return {
name: 'storybook:sveltekit-overrides',
config: (conf) => {
// Some versions of sveltekit set ssr, we need it to be false
if (conf.build?.ssr) {
// eslint-disable-next-line no-param-reassign
conf.build.ssr = false;
}
return conf;
},
} satisfies Plugin;
}
11 changes: 7 additions & 4 deletions code/frameworks/sveltekit/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { viteFinal as svelteViteFinal } from '@storybook/svelte-vite/preset';
import type { PresetProperty } from '@storybook/types';
import { withoutVitePlugins } from '@storybook/builder-vite';
import { configOverrides } from './plugins/config-overrides';
import { type StorybookConfig } from './types';

export const core: PresetProperty<'core', StorybookConfig> = {
Expand All @@ -16,10 +17,12 @@ export const viteFinal: NonNullable<StorybookConfig['viteFinal']> = async (confi

// Remove vite-plugin-svelte-kit from plugins if using SvelteKit
// see https://github.com/storybookjs/storybook/issues/19280#issuecomment-1281204341
plugins = await withoutVitePlugins(plugins, [
// @sveltejs/[email protected] and later
'vite-plugin-sveltekit-compile',
]);
plugins = (
await withoutVitePlugins(plugins, [
// @sveltejs/[email protected] and later
'vite-plugin-sveltekit-compile',
])
).concat(configOverrides());

return { ...baseConfig, plugins };
};

0 comments on commit 3ef1144

Please sign in to comment.