Skip to content
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

fix: pass options read from config file to svelteDocgen #449

Merged
merged 1 commit into from
Jul 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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