Unverified Commit 7c8d0062 authored by Shu Ding's avatar Shu Ding Committed by GitHub

Move `modularizeImports` out of experimental (#44240)

parent 9ee4c0cd
...@@ -115,7 +115,7 @@ function getBaseSWCOptions({ ...@@ -115,7 +115,7 @@ function getBaseSWCOptions({
reactRemoveProperties: jest reactRemoveProperties: jest
? false ? false
: nextConfig?.compiler?.reactRemoveProperties, : nextConfig?.compiler?.reactRemoveProperties,
modularizeImports: nextConfig?.experimental?.modularizeImports, modularizeImports: nextConfig?.modularizeImports,
relay: nextConfig?.compiler?.relay, relay: nextConfig?.compiler?.relay,
// Always transform styled-jsx and error when `client-only` condition is triggered // Always transform styled-jsx and error when `client-only` condition is triggered
styledJsx: true, styledJsx: true,
......
...@@ -2155,6 +2155,7 @@ export default async function getBaseWebpackConfig( ...@@ -2155,6 +2155,7 @@ export default async function getBaseWebpackConfig(
!!config.skipMiddlewareUrlNormalize, !!config.skipMiddlewareUrlNormalize,
], ],
['skipTrailingSlashRedirect', !!config.skipTrailingSlashRedirect], ['skipTrailingSlashRedirect', !!config.skipTrailingSlashRedirect],
['modularizeImports', !!config.modularizeImports],
SWCBinaryTarget, SWCBinaryTarget,
].filter<[Feature, boolean]>(Boolean as any) ].filter<[Feature, boolean]>(Boolean as any)
) )
...@@ -2304,7 +2305,7 @@ export default async function getBaseWebpackConfig( ...@@ -2304,7 +2305,7 @@ export default async function getBaseWebpackConfig(
styledComponents: config.compiler?.styledComponents, styledComponents: config.compiler?.styledComponents,
relay: config.compiler?.relay, relay: config.compiler?.relay,
emotion: config.compiler?.emotion, emotion: config.compiler?.emotion,
modularizeImports: config.experimental?.modularizeImports, modularizeImports: config.modularizeImports,
legacyBrowsers: config.experimental?.legacyBrowsers, legacyBrowsers: config.experimental?.legacyBrowsers,
imageLoaderFile: config.images.loaderFile, imageLoaderFile: config.images.loaderFile,
}) })
......
...@@ -40,6 +40,7 @@ export type Feature = ...@@ -40,6 +40,7 @@ export type Feature =
| 'transpilePackages' | 'transpilePackages'
| 'skipMiddlewareUrlNormalize' | 'skipMiddlewareUrlNormalize'
| 'skipTrailingSlashRedirect' | 'skipTrailingSlashRedirect'
| 'modularizeImports'
interface FeatureUsage { interface FeatureUsage {
featureName: Feature featureName: Feature
...@@ -102,6 +103,7 @@ const BUILD_FEATURES: Array<Feature> = [ ...@@ -102,6 +103,7 @@ const BUILD_FEATURES: Array<Feature> = [
'transpilePackages', 'transpilePackages',
'skipMiddlewareUrlNormalize', 'skipMiddlewareUrlNormalize',
'skipTrailingSlashRedirect', 'skipTrailingSlashRedirect',
'modularizeImports',
] ]
const ELIMINATED_PACKAGES = new Set<string>() const ELIMINATED_PACKAGES = new Set<string>()
......
...@@ -310,9 +310,6 @@ const configSchema = { ...@@ -310,9 +310,6 @@ const configSchema = {
enum: ['strict', 'flexible'] as any, enum: ['strict', 'flexible'] as any,
type: 'string', type: 'string',
}, },
modularizeImports: {
type: 'object',
},
newNextLinkBehavior: { newNextLinkBehavior: {
type: 'boolean', type: 'boolean',
}, },
...@@ -629,6 +626,9 @@ const configSchema = { ...@@ -629,6 +626,9 @@ const configSchema = {
}, },
type: 'object', type: 'object',
}, },
modularizeImports: {
type: 'object',
},
onDemandEntries: { onDemandEntries: {
additionalProperties: false, additionalProperties: false,
properties: { properties: {
......
...@@ -120,14 +120,6 @@ export interface ExperimentalConfig { ...@@ -120,14 +120,6 @@ export interface ExperimentalConfig {
urlImports?: NonNullable<webpack.Configuration['experiments']>['buildHttp'] urlImports?: NonNullable<webpack.Configuration['experiments']>['buildHttp']
outputFileTracingRoot?: string outputFileTracingRoot?: string
outputFileTracingIgnores?: string[] outputFileTracingIgnores?: string[]
modularizeImports?: Record<
string,
{
transform: string
preventFullImport?: boolean
skipDefaultConversion?: boolean
}
>
swcTraceProfiling?: boolean swcTraceProfiling?: boolean
forceSwcTransforms?: boolean forceSwcTransforms?: boolean
...@@ -508,6 +500,15 @@ export interface NextConfig extends Record<string, any> { ...@@ -508,6 +500,15 @@ export interface NextConfig extends Record<string, any> {
skipTrailingSlashRedirect?: boolean skipTrailingSlashRedirect?: boolean
modularizeImports?: Record<
string,
{
transform: string
preventFullImport?: boolean
skipDefaultConversion?: boolean
}
>
/** /**
* Enable experimental features. Note that all experimental features are subject to breaking changes in the future. * Enable experimental features. Note that all experimental features are subject to breaking changes in the future.
*/ */
...@@ -566,6 +567,7 @@ export const defaultConfig: NextConfig = { ...@@ -566,6 +567,7 @@ export const defaultConfig: NextConfig = {
staticPageGenerationTimeout: 60, staticPageGenerationTimeout: 60,
swcMinify: true, swcMinify: true,
output: !!process.env.NEXT_PRIVATE_STANDALONE ? 'standalone' : undefined, output: !!process.env.NEXT_PRIVATE_STANDALONE ? 'standalone' : undefined,
modularizeImports: undefined,
experimental: { experimental: {
fetchCache: false, fetchCache: false,
middlewarePrefetch: 'flexible', middlewarePrefetch: 'flexible',
...@@ -608,7 +610,6 @@ export const defaultConfig: NextConfig = { ...@@ -608,7 +610,6 @@ export const defaultConfig: NextConfig = {
disablePostcssPresetEnv: undefined, disablePostcssPresetEnv: undefined,
amp: undefined, amp: undefined,
urlImports: undefined, urlImports: undefined,
modularizeImports: undefined,
enableUndici: false, enableUndici: false,
adjustFontFallbacks: false, adjustFontFallbacks: false,
adjustFontFallbacksWithSizeAdjust: false, adjustFontFallbacksWithSizeAdjust: false,
......
...@@ -169,6 +169,7 @@ export type EventBuildFeatureUsage = { ...@@ -169,6 +169,7 @@ export type EventBuildFeatureUsage = {
| 'transpilePackages' | 'transpilePackages'
| 'skipMiddlewareUrlNormalize' | 'skipMiddlewareUrlNormalize'
| 'skipTrailingSlashRedirect' | 'skipTrailingSlashRedirect'
| 'modularizeImports'
invocationCount: number invocationCount: number
} }
export function eventBuildFeatureUsage( export function eventBuildFeatureUsage(
......
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