Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/canary' into update/polyfill-test
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Jun 24, 2021
2 parents 40b5014 + 3cd4f34 commit 6f1127c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
17 changes: 12 additions & 5 deletions packages/next/build/babel/loader/get-config.ts
Original file line number Diff line number Diff line change
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
6 changes: 5 additions & 1 deletion packages/next/lib/typescript/writeAppTypeDeclarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export async function writeAppTypeDeclarations(
os.EOL +
(imageImportsEnabled
? '/// <reference types="next/image-types/global" />' + os.EOL
: '')
: '') +
os.EOL +
'// NOTE: This file should not be edited' +
os.EOL +
'// see https://nextjs.org/docs/basic-features/typescript for more information.'
)
}

0 comments on commit 6f1127c

Please sign in to comment.