From f859e0b160b561923ac62841e819ffbb56d92538 Mon Sep 17 00:00:00 2001 From: chakAs3 Date: Mon, 15 Jan 2024 09:12:37 +0400 Subject: [PATCH 1/2] replace vite:vue with nuxt version --- packages/storybook-nuxt/src/preset.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/storybook-nuxt/src/preset.ts b/packages/storybook-nuxt/src/preset.ts index f3b7de1..97711ee 100644 --- a/packages/storybook-nuxt/src/preset.ts +++ b/packages/storybook-nuxt/src/preset.ts @@ -91,10 +91,21 @@ async function defineNuxtConfig(baseConfig: Record) { { isClient }: any, ) => { if (isClient) { - const plugins = baseConfig.plugins.filter((plugin: any) => plugin.name !== 'vite:vue') - baseConfig.plugins = [...plugins, - vuePlugin(), - ] + const plugins = baseConfig.plugins + + // Find the index of the plugin with name 'vite:vue' + const index = plugins.findIndex((plugin: any) => plugin.name === 'vite:vue') + + // Check if the plugin was found + if (index !== -1) { + // Replace the plugin with the new one using vuePlugin() + plugins[index] = vuePlugin() + } + else { + // Handle the case where the plugin with name 'vite:vue' was not found + console.error('Plugin \'vite:vue\' not found in the array.') + } + baseConfig.plugins = plugins extendedConfig = mergeConfig(config, baseConfig) } }, From b34f2d5231f5a722a85dd051b1bf4c829ddbe90a Mon Sep 17 00:00:00 2001 From: chakAs3 Date: Mon, 15 Jan 2024 16:36:02 +0400 Subject: [PATCH 2/2] update playground for pages routing --- packages/storybook-nuxt/playground/app.vue | 5 +- .../playground/components/MyNuxtPage.vue | 67 +++++++++---------- .../storybook-nuxt/playground/pages/about.vue | 7 +- .../storybook-nuxt/playground/pages/index.vue | 3 +- .../playground/pages/parent.vue | 2 +- .../stories/pages/CustomNav.stories.ts | 5 +- packages/storybook-nuxt/src/preset.ts | 4 +- 7 files changed, 42 insertions(+), 51 deletions(-) diff --git a/packages/storybook-nuxt/playground/app.vue b/packages/storybook-nuxt/playground/app.vue index ec738a1..63e642b 100644 --- a/packages/storybook-nuxt/playground/app.vue +++ b/packages/storybook-nuxt/playground/app.vue @@ -1,6 +1,9 @@ diff --git a/packages/storybook-nuxt/playground/components/MyNuxtPage.vue b/packages/storybook-nuxt/playground/components/MyNuxtPage.vue index f04ecb1..c0b322a 100644 --- a/packages/storybook-nuxt/playground/components/MyNuxtPage.vue +++ b/packages/storybook-nuxt/playground/components/MyNuxtPage.vue @@ -1,58 +1,53 @@ diff --git a/packages/storybook-nuxt/playground/pages/about.vue b/packages/storybook-nuxt/playground/pages/about.vue index 4e8b5f0..3b965de 100644 --- a/packages/storybook-nuxt/playground/pages/about.vue +++ b/packages/storybook-nuxt/playground/pages/about.vue @@ -5,12 +5,9 @@ defineProps({ diff --git a/packages/storybook-nuxt/playground/pages/index.vue b/packages/storybook-nuxt/playground/pages/index.vue index eb07db3..d708ce7 100644 --- a/packages/storybook-nuxt/playground/pages/index.vue +++ b/packages/storybook-nuxt/playground/pages/index.vue @@ -5,9 +5,8 @@ defineProps({