diff --git a/src/index.ts b/src/index.ts index d6a35bcf..8b0ba073 100644 --- a/src/index.ts +++ b/src/index.ts @@ -86,7 +86,7 @@ const typescript: PluginImpl = (options) => { check: true, verbosity: VerbosityLevel.Warning, - clean: true, + clean: !options?.extraCacheKeys && (options?.sourceMapCallback || options?.transformers), cacheRoot: findCacheDir({ name: "rollup-plugin-typescript2" }), include: ["*.ts+(|x)", "**/*.ts+(|x)"], exclude: ["*.d.ts", "**/*.d.ts"], @@ -99,6 +99,7 @@ const typescript: PluginImpl = (options) => tsconfigDefaults: {}, objectHashIgnoreUnknownHack: false, cwd: process.cwd(), + extraCacheKeys: [] }, options as IOptions); if (!pluginOptions.typescript) { diff --git a/src/ioptions.ts b/src/ioptions.ts index 1f7ad458..d4ba98d1 100644 --- a/src/ioptions.ts +++ b/src/ioptions.ts @@ -30,4 +30,5 @@ export interface IOptions tsconfigDefaults: any; sourceMapCallback: (id: string, map: string) => void; objectHashIgnoreUnknownHack: boolean; + extraCacheKeys: string[] }