@sentry/bundler-plugins declares rollup as an optional peer dependency, but its built type definitions for the ./rollup export import TransformResult directly from rollup.
Because the ./vite export transitively imports from the rollup module, consumers of @sentry/vite-plugin (or @sentry/bundler-plugins/vite) who do not have rollup installed hit a TS2307 error.
Reproduction
import { sentryVitePlugin } from '@sentry/vite-plugin';
TypeScript reports:
node_modules/@sentry/bundler-plugins/build/types/rollup/index.d.ts:5:38 - error TS2307: Cannot find module 'rollup' or its corresponding type declarations.
5 import type { TransformResult } from 'rollup';
Findings
packages/bundler-plugins/package.json has rollup in peerDependencies with optional: true.
packages/bundler-plugins/src/rollup/index.ts line 23: import type { TransformResult } from 'rollup';.
packages/bundler-plugins/src/vite/index.ts imports from ../rollup, so the Vite type path depends on the Rollup type file.
@sentry/bundler-pluginsdeclaresrollupas an optional peer dependency, but its built type definitions for the./rollupexport importTransformResultdirectly fromrollup.Because the
./viteexport transitively imports from the rollup module, consumers of@sentry/vite-plugin(or@sentry/bundler-plugins/vite) who do not haverollupinstalled hit a TS2307 error.Reproduction
TypeScript reports:
Findings
packages/bundler-plugins/package.jsonhasrollupinpeerDependencieswithoptional: true.packages/bundler-plugins/src/rollup/index.tsline 23:import type { TransformResult } from 'rollup';.packages/bundler-plugins/src/vite/index.tsimports from../rollup, so the Vite type path depends on the Rollup type file.