Skip to content

Commit

Permalink
Merge pull request #241 from storybookjs/remove-post
Browse files Browse the repository at this point in the history
chore: Remove Vite plugin `post` enforcement
  • Loading branch information
JReinhold authored Dec 10, 2024
2 parents 4f5cb24 + 28144a7 commit 52910d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/compiler/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function preTransformPlugin(): Promise<Plugin> {
};
}

export async function postTransformPlugin(): Promise<Plugin> {
export async function transformPlugin(): Promise<Plugin> {
const [{ createFilter }, { loadSvelteConfig }] = await Promise.all([
import('vite'),
import('@sveltejs/vite-plugin-svelte'),
Expand All @@ -68,8 +68,7 @@ export async function postTransformPlugin(): Promise<Plugin> {
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;

Expand Down
4 changes: 2 additions & 2 deletions src/preset.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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,
Expand Down

0 comments on commit 52910d0

Please sign in to comment.