Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove Vite plugin post enforcement #241

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading