Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging when a custom babelrc is loaded #26570

Merged
merged 2 commits into from Jun 24, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions packages/next/build/babel/loader/get-config.ts
Expand Up @@ -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)/

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down