Unverified Commit 3daa473e authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Disable Terser Cache When Using Flying Shuttle (#7168)

parent 6f0e795f
......@@ -73,7 +73,7 @@ export default async function getBaseWebpackConfig (dir: string, {dev = false, d
const terserPluginConfig = {
parallel: true,
sourceMap: false,
cache: true,
cache: !selectivePageBuilding,
cpus: config.experimental.cpus,
distDir: distDir
}
......
......@@ -12,8 +12,10 @@ const writeFileP = promisify(writeFile)
const readFileP = promisify(readFile)
export default class TaskRunner {
constructor(distDir, cpus) {
mkdirp.sync((this.cacheDir = join(distDir, 'cache', 'next-minifier')))
constructor({ distDir, cpus, cache }) {
if (cache) {
mkdirp.sync((this.cacheDir = join(distDir, 'cache', 'next-minifier')))
}
// In some cases cpus() returns undefined
// https://github.com/nodejs/node/issues/19022
......@@ -68,7 +70,7 @@ export default class TaskRunner {
}
tasks.forEach((task, index) => {
const cachePath = join(this.cacheDir, task.cacheKey)
const cachePath = this.cacheDir && join(this.cacheDir, task.cacheKey)
const enqueue = () => {
this.boundWorkers(task, (error, data) => {
......
......@@ -129,7 +129,11 @@ export class TerserPlugin {
apply(compiler) {
const optimizeFn = (compilation, chunks, callback) => {
const taskRunner = new TaskRunner(this.distDir, this.cpus)
const taskRunner = new TaskRunner({
distDir: this.distDir,
cpus: this.cpus,
cache: this.options.cache,
})
const processedAssets = new WeakSet()
const tasks = []
......@@ -285,7 +289,7 @@ export class TerserPlugin {
template.hooks.hashForChunk.tap(plugin, hash => {
// Terser version
// Has to be updated when options change too
hash.update('3.17.0');
hash.update('3.17.0')
return hash
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment