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