diff --git a/src/rollup/index.ts b/src/rollup/index.ts index ee9db367470..cc6b223a90d 100644 --- a/src/rollup/index.ts +++ b/src/rollup/index.ts @@ -170,7 +170,9 @@ export default function rollup( curWatcher = undefined; // remove the cache option from the memory after graph creation (cache is not used anymore) + const useCache = rawInputOptions.cache !== false; delete inputOptions.cache; + delete rawInputOptions.cache; timeStart('BUILD', 1); @@ -377,7 +379,7 @@ export default function rollup( }); } - const cache = rawInputOptions.cache === false ? undefined : graph.getCache(); + const cache = useCache ? graph.getCache() : undefined; const result: RollupSingleFileBuild | RollupBuild = { cache, watchFiles: Object.keys(graph.watchFiles), diff --git a/test/leak/index.js b/test/leak/index.js index e2e463fe860..692f2a8816e 100644 --- a/test/leak/index.js +++ b/test/leak/index.js @@ -18,7 +18,7 @@ function run() { }) .then(bundle => { weak(bundle, onCollect); - cache = bundle.cache; + cache = bundle; global.gc(); if (shouldCollect && !isCollected) { throw new Error('Memory leak detected');