Unverified Commit 77895fd0 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Add logging when a custom babelrc is loaded (#26570)

Partially solves #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
parent 650ebed7
...@@ -6,6 +6,7 @@ import loadConfig from 'next/dist/compiled/babel/core-lib-config' ...@@ -6,6 +6,7 @@ import loadConfig from 'next/dist/compiled/babel/core-lib-config'
import { NextBabelLoaderOptions, NextJsLoaderContext } from './types' import { NextBabelLoaderOptions, NextJsLoaderContext } from './types'
import { consumeIterator } from './util' import { consumeIterator } from './util'
import * as Log from '../../output/log'
const nextDistPath = /(next[\\/]dist[\\/]next-server[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/ const nextDistPath = /(next[\\/]dist[\\/]next-server[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/
...@@ -181,11 +182,6 @@ function getFreshConfig( ...@@ -181,11 +182,6 @@ function getFreshConfig(
configFile, configFile,
} = loaderOptions } = loaderOptions
// Ensures webpack invalidates the cache for this loader when the config file changes
if (configFile) {
this.addDependency(configFile)
}
let customConfig: any = configFile let customConfig: any = configFile
? getCustomBabelConfig(configFile) ? getCustomBabelConfig(configFile)
: undefined : undefined
...@@ -329,6 +325,11 @@ export default function getConfig( ...@@ -329,6 +325,11 @@ export default function getConfig(
filename 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) const cacheKey = getCacheKey(cacheCharacteristics)
if (configCache.has(cacheKey)) { if (configCache.has(cacheKey)) {
const cachedConfig = configCache.get(cacheKey) const cachedConfig = configCache.get(cacheKey)
...@@ -345,6 +346,12 @@ export default function getConfig( ...@@ -345,6 +346,12 @@ export default function getConfig(
} }
} }
if (loaderOptions.configFile) {
Log.info(
`Using external babel configuration from ${loaderOptions.configFile}`
)
}
const freshConfig = getFreshConfig.call( const freshConfig = getFreshConfig.call(
this, this,
cacheCharacteristics, cacheCharacteristics,
......
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