From bdf3d80f3512566a76a39579e34c939031a893b1 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Thu, 24 Jun 2021 14:16:20 +0200 Subject: [PATCH] Add back logging when a custom babelrc is loaded Partially solves #26539 by adding back the log output when a config file is used --- packages/next/build/babel/loader/get-config.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/next/build/babel/loader/get-config.ts b/packages/next/build/babel/loader/get-config.ts index e44d07822851d2b..28623f75e8e3ec7 100644 --- a/packages/next/build/babel/loader/get-config.ts +++ b/packages/next/build/babel/loader/get-config.ts @@ -6,6 +6,7 @@ import loadConfig from 'next/dist/compiled/babel/core-lib-config' import { NextBabelLoaderOptions, NextJsLoaderContext } from './types' import { consumeIterator } from './util' +import * as Log from '../../output/log' const nextDistPath = /(next[\\/]dist[\\/]next-server[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/ @@ -181,11 +182,6 @@ function getFreshConfig( configFile, } = loaderOptions - // Ensures webpack invalidates the cache for this loader when the config file changes - if (configFile) { - this.addDependency(configFile) - } - let customConfig: any = configFile ? getCustomBabelConfig(configFile) : undefined @@ -329,6 +325,11 @@ export default function getConfig( filename ) + if (loaderOptions.configFile) { + // Ensures webpack invalidates the cache for this loader when the config file changes + this.addDependency(loaderOptions.configFile) + } + const cacheKey = getCacheKey(cacheCharacteristics) if (configCache.has(cacheKey)) { const cachedConfig = configCache.get(cacheKey) @@ -345,6 +346,12 @@ export default function getConfig( } } + if (loaderOptions.configFile) { + Log.info( + `Using external babel configuration from ${loaderOptions.configFile}` + ) + } + const freshConfig = getFreshConfig.call( this, cacheCharacteristics,