From 3cbcacd01f97fbb863fd93090ce352c040ea43bd Mon Sep 17 00:00:00 2001 From: Ian VanSchooten Date: Fri, 8 Jul 2022 17:51:54 -0400 Subject: [PATCH] Load @sveltejs/vite-plugin-svelte conditionally (#434) It was being imported at the top of the file, which means for all frameworks. Instead, this requires it conditionally only for svelte projects. --- packages/builder-vite/vite-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder-vite/vite-config.ts b/packages/builder-vite/vite-config.ts index 9554af91..db76cbda 100644 --- a/packages/builder-vite/vite-config.ts +++ b/packages/builder-vite/vite-config.ts @@ -2,7 +2,6 @@ import * as path from 'path'; import fs from 'fs'; import { Plugin } from 'vite'; import { TypescriptConfig } from '@storybook/core-common'; -import { loadSvelteConfig } from '@sveltejs/vite-plugin-svelte'; import viteReact from '@vitejs/plugin-react'; import { allowedEnvPrefix as envPrefix } from './envs'; @@ -146,6 +145,7 @@ export async function pluginConfig(options: ExtendedOptions, _type: PluginConfig try { const csfPlugin = require('./svelte/csf-plugin').default; + const { loadSvelteConfig } = require('@sveltejs/vite-plugin-svelte'); const config = loadSvelteConfig(); plugins.push(csfPlugin({ ...config, ...svelteOptions })); } catch (err) {