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