Skip to content

Commit

Permalink
fix: pass options read from config file to svelteDocgen (#449)
Browse files Browse the repository at this point in the history
Looks like we only passed the options from the config file to `csfPlugin` and missed `svelteDocgen`
  • Loading branch information
benmccann authored Jul 21, 2022
1 parent ab8ccdc commit a4f17ea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/builder-vite/vite-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,12 @@ export async function pluginConfig(options: ExtendedOptions, _type: PluginConfig
throw err;
}

const { loadSvelteConfig } = require('@sveltejs/vite-plugin-svelte');
const config = { ...loadSvelteConfig(), ...svelteOptions };

try {
const csfPlugin = require('./svelte/csf-plugin').default;
const { loadSvelteConfig } = require('@sveltejs/vite-plugin-svelte');
const config = loadSvelteConfig();
plugins.push(csfPlugin({ ...config, ...svelteOptions }));
plugins.push(csfPlugin(config));
} catch (err) {
// Not all projects use `.stories.svelte` for stories, and by default 6.5+ does not auto-install @storybook/addon-svelte-csf.
// If it's any other kind of error, re-throw.
Expand All @@ -157,7 +158,7 @@ export async function pluginConfig(options: ExtendedOptions, _type: PluginConfig
}

const { svelteDocgen } = await import('./plugins/svelte-docgen');
plugins.push(svelteDocgen(svelteOptions));
plugins.push(svelteDocgen(config));
}

if (framework === 'preact') {
Expand Down

0 comments on commit a4f17ea

Please sign in to comment.