Commit 842a2905 authored by JJ Kasper's avatar JJ Kasper Committed by Joe Haddad

Disable babel-loader cache in flying shuttle mode (#7365)

* Disable babel-loader cache in flying shuttle mode

* Move cleaning up old babel-loader caches

* Change option name for disabling cache on babel-loader
parent c7798894
......@@ -89,6 +89,7 @@ export default async function build(dir: string, conf = null): Promise<void> {
await recursiveDelete(distDir, /^(?!cache(?:[\/\\]|$)).*$/)
await recursiveDelete(path.join(distDir, 'cache', 'next-minifier'))
await recursiveDelete(path.join(distDir, 'cache', 'next-babel-loader'))
flyingShuttle = new FlyingShuttle({
buildId,
......
......@@ -67,6 +67,7 @@ export default async function getBaseWebpackConfig(
isServer,
distDir,
cwd: dir,
cache: !selectivePageBuilding,
asyncToPromises: config.experimental.asyncToPromises,
},
},
......
......@@ -19,7 +19,7 @@ module.exports = babelLoader.custom(babel => {
asyncToPromises: opts.asyncToPromises
}
const filename = join(opts.cwd, 'noop.js')
const loader = Object.assign({
const loader = Object.assign(opts.cache ? {
cacheCompression: false,
cacheDirectory: join(opts.distDir, 'cache', 'next-babel-loader'),
cacheIdentifier: cacheKey + JSON.stringify(
......@@ -29,10 +29,13 @@ module.exports = babelLoader.custom(babel => {
sourceFileName: filename
}).options
)
} : {
cacheDirectory: false
}, opts)
delete loader.isServer
delete loader.asyncToPromises
delete loader.cache
delete loader.distDir
return { loader, custom }
},
......
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