Skip to content

Commit 6370c7d

Browse files
authored
fix(bundler): do not import type from optional peer dep (#22304)
fix: #22296 fix: JS-3054
1 parent 159e40b commit 6370c7d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • packages/bundler-plugins/src/rollup

packages/bundler-plugins/src/rollup/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ import type {
2020
} from '../core/component-annotation-vite';
2121
import type { SourceMap } from 'magic-string';
2222
import MagicString from 'magic-string';
23-
import type { TransformResult } from 'rollup';
2423
import * as path from 'node:path';
2524
import { createRequire } from 'node:module';
2625

26+
// The subset of Rollup's `TransformResult` that this plugin's `transform`
27+
// hook actually returns. Defined locally instead of imported from `rollup`
28+
// because `rollup` is an optional dependency.
29+
type TransformResult = { code: string; map?: SourceMap | string | { mappings: string } | null } | null | undefined;
30+
2731
type ViteModule = {
2832
parseAstAsync?: (code: string, options: { lang: 'jsx' | 'tsx' }) => Promise<unknown>;
2933
};

0 commit comments

Comments
 (0)