diff --git a/src/compiler/plugins.ts b/src/compiler/plugins.ts index e717ea8..503dd69 100644 --- a/src/compiler/plugins.ts +++ b/src/compiler/plugins.ts @@ -57,7 +57,7 @@ export async function preTransformPlugin(): Promise { }; } -export async function postTransformPlugin(): Promise { +export async function transformPlugin(): Promise { const [{ createFilter }, { loadSvelteConfig }] = await Promise.all([ import('vite'), import('@sveltejs/vite-plugin-svelte'), @@ -68,8 +68,7 @@ export async function postTransformPlugin(): Promise { const filter = createFilter(include); return { - name: 'storybook:addon-svelte-csf-plugin-post', - enforce: 'post', + name: 'storybook:addon-svelte-csf', async transform(compiledCode, id) { if (!filter(id)) return undefined; diff --git a/src/preset.ts b/src/preset.ts index fe6d511..6260e9b 100644 --- a/src/preset.ts +++ b/src/preset.ts @@ -1,7 +1,7 @@ import type { StorybookConfig } from '@storybook/svelte-vite'; import type { Options } from '@storybook/types'; -import { postTransformPlugin, preTransformPlugin } from '#compiler/plugins'; +import { transformPlugin, preTransformPlugin } from '#compiler/plugins'; import { createIndexer } from '#indexer/index'; export interface StorybookAddonSvelteCsFOptions extends Options { @@ -28,7 +28,7 @@ export const viteFinal: StorybookConfig['viteFinal'] = async ( if (legacyTemplate) { plugins.unshift(await preTransformPlugin()); } - plugins.push(await postTransformPlugin()); + plugins.push(await transformPlugin()); return { ...restConfig,