diff --git a/packages/typescript/src/options/validate.ts b/packages/typescript/src/options/validate.ts index c772ac0c1..5cb6a4c38 100644 --- a/packages/typescript/src/options/validate.ts +++ b/packages/typescript/src/options/validate.ts @@ -65,6 +65,11 @@ export function validatePaths( `@rollup/plugin-typescript: Path of Typescript compiler option '${dirProperty}' must be located inside Rollup 'dir' option.` ); } + } else if(dirProperty === 'outDir') { + const fromTsDirToRollup = relative(compilerOptions[dirProperty],outputDir); + if (fromTsDirToRollup.startsWith('..')) { + context.error(`@rollup/plugin-typescript: Path of Typescript compiler option '${dirProperty}' must be located inside the same directory as the Rollup 'file' option.`); + } } else { const fromTsDirToRollup = relative(outputDir, compilerOptions[dirProperty]!); if (fromTsDirToRollup.startsWith('..')) {