Unverified Commit 0b0d03a0 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

[chore] remove legacy useEarlyImport flag (#80112)

parent cdb6d257
......@@ -715,10 +715,6 @@ export async function createEntrypoints(
basePath: config.basePath,
assetPrefix: config.assetPrefix,
nextConfigOutput: config.output,
nextConfigExperimentalUseEarlyImport: config.experimental
.useEarlyImport
? true
: undefined,
preferredRegion: staticInfo.preferredRegion,
middlewareConfig: encodeToBase64(staticInfo.middleware || {}),
isGlobalNotFoundEnabled: config.experimental.globalNotFound
......
......@@ -48,7 +48,6 @@ export type AppLoaderOptions = {
isDev?: true
basePath: string
nextConfigOutput?: NextConfig['output']
nextConfigExperimentalUseEarlyImport?: true
middlewareConfig: string
isGlobalNotFoundEnabled: true | undefined
}
......@@ -553,7 +552,6 @@ const nextAppLoader: AppLoader = async function nextAppLoader() {
preferredRegion,
basePath,
middlewareConfig: middlewareConfigBase64,
nextConfigExperimentalUseEarlyImport,
} = loaderOptions
const isGlobalNotFoundEnabled = !!loaderOptions.isGlobalNotFoundEnabled
......@@ -839,25 +837,14 @@ const nextAppLoader: AppLoader = async function nextAppLoader() {
}
)
const header =
nextConfigExperimentalUseEarlyImport &&
process.env.NODE_ENV === 'production'
? // Evaluate the imported modules early in the generated code
collectedDeclarations
.map(([varName, modulePath]) => {
return `import * as ${varName}_ from ${JSON.stringify(
modulePath
)};\nconst ${varName} = () => ${varName}_;\n`
})
.join('')
: // Lazily evaluate the imported modules in the generated code
collectedDeclarations
.map(([varName, modulePath]) => {
return `const ${varName} = () => import(/* webpackMode: "eager" */ ${JSON.stringify(
modulePath
)});\n`
})
.join('')
// Lazily evaluate the imported modules in the generated code
const header = collectedDeclarations
.map(([varName, modulePath]) => {
return `const ${varName} = () => import(/* webpackMode: "eager" */ ${JSON.stringify(
modulePath
)});\n`
})
.join('')
return header + code
}
......
......@@ -468,7 +468,6 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
serverSourceMaps: z.boolean().optional(),
useWasmBinary: z.boolean().optional(),
useLightningcss: z.boolean().optional(),
useEarlyImport: z.boolean().optional(),
testProxy: z.boolean().optional(),
defaultTestRunner: z.enum(SUPPORTED_TEST_RUNNERS_LIST).optional(),
allowDevelopmentBuild: z.literal(true).optional(),
......
......@@ -586,11 +586,6 @@ export interface ExperimentalConfig {
*/
useLightningcss?: boolean
/**
* Enables early import feature for app router modules
*/
useEarlyImport?: boolean
/**
* Enables view transitions by using the {@link https://github.com/facebook/react/pull/31975 unstable_ViewTransition} Component.
*/
......@@ -1370,7 +1365,6 @@ export const defaultConfig = {
webpackBuildWorker: undefined,
webpackMemoryOptimizations: false,
optimizeServerReact: true,
useEarlyImport: false,
viewTransition: false,
routerBFCache: false,
removeUncaughtErrorAndRejectionListeners: false,
......
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