Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit ff2faa5

Browse files
authored
Add logging when a custom babelrc is loaded (vercel#26570)
Partially solves vercel#26539 by adding back the log output when a config file is used ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. ## Documentation / Examples - [ ] Make sure the linting passes
1 parent 72e05f6 commit ff2faa5

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

packages/next/build/babel/loader/get-config.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import loadConfig from 'next/dist/compiled/babel/core-lib-config'
66

77
import { NextBabelLoaderOptions, NextJsLoaderContext } from './types'
88
import { consumeIterator } from './util'
9+
import * as Log from '../../output/log'
910

1011
const nextDistPath = /(next[\\/]dist[\\/]next-server[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/
1112

@@ -181,11 +182,6 @@ function getFreshConfig(
181182
configFile,
182183
} = loaderOptions
183184

184-
// Ensures webpack invalidates the cache for this loader when the config file changes
185-
if (configFile) {
186-
this.addDependency(configFile)
187-
}
188-
189185
let customConfig: any = configFile
190186
? getCustomBabelConfig(configFile)
191187
: undefined
@@ -329,6 +325,11 @@ export default function getConfig(
329325
filename
330326
)
331327

328+
if (loaderOptions.configFile) {
329+
// Ensures webpack invalidates the cache for this loader when the config file changes
330+
this.addDependency(loaderOptions.configFile)
331+
}
332+
332333
const cacheKey = getCacheKey(cacheCharacteristics)
333334
if (configCache.has(cacheKey)) {
334335
const cachedConfig = configCache.get(cacheKey)
@@ -345,6 +346,12 @@ export default function getConfig(
345346
}
346347
}
347348

349+
if (loaderOptions.configFile) {
350+
Log.info(
351+
`Using external babel configuration from ${loaderOptions.configFile}`
352+
)
353+
}
354+
348355
const freshConfig = getFreshConfig.call(
349356
this,
350357
cacheCharacteristics,

0 commit comments

Comments
 (0)