From f94510bb7208322f8dcca9d995c91e2c4c2472d4 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 15 Jul 2026 11:34:41 -0700 Subject: [PATCH] fix(bundler): do not import type from optional peer dep fix: #22296 fix: JS-3054 --- packages/bundler-plugins/src/rollup/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/bundler-plugins/src/rollup/index.ts b/packages/bundler-plugins/src/rollup/index.ts index c8371fe20a27..c53ce21245bd 100644 --- a/packages/bundler-plugins/src/rollup/index.ts +++ b/packages/bundler-plugins/src/rollup/index.ts @@ -20,10 +20,14 @@ import type { } from '../core/component-annotation-vite'; import type { SourceMap } from 'magic-string'; import MagicString from 'magic-string'; -import type { TransformResult } from 'rollup'; import * as path from 'node:path'; import { createRequire } from 'node:module'; +// The subset of Rollup's `TransformResult` that this plugin's `transform` +// hook actually returns. Defined locally instead of imported from `rollup` +// because `rollup` is an optional dependency. +type TransformResult = { code: string; map?: SourceMap | string | { mappings: string } | null } | null | undefined; + type ViteModule = { parseAstAsync?: (code: string, options: { lang: 'jsx' | 'tsx' }) => Promise; };