Skip to content

Commit

Permalink
fix: bug where vue is included twice
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianMar committed Nov 8, 2023
1 parent 472617b commit 8870713
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions packages/storybook-nuxt/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,22 @@ export const viteFinal: StorybookConfig['viteFinal'] = async (
config: Record<string, any>,
options: any,
) => {
const getStorybookViteConfig = async (c: Record<string, any>, o: any) => {
// const pkgPath = await getPackageDir('@storybook/vue3-vite')
const presetURL = pathToFileURL(join(await getPackageDir('@storybook/vue3-vite'), 'preset.js'))
const { viteFinal: ViteFile } = await import(presetURL.href)

if (!ViteFile)
throw new Error('ViteFile not found')
return ViteFile(c, o)
}
const getStorybookViteConfig: StorybookConfig['viteFinal'] = async (config, { presets }) => {
const plugins: PluginOption[] = [];

// Add docgen plugin
plugins.push(vueDocgen());

return mergeConfig(config, {
plugins,
resolve: {
alias: {
vue: 'vue/dist/vue.esm-bundler.js',
},
},
});
};

const nuxtConfig = await defineNuxtConfig(await getStorybookViteConfig(config, options))

return mergeConfig(nuxtConfig.viteConfig, {
Expand Down

0 comments on commit 8870713

Please sign in to comment.