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

Move modularizeImports out of experimental #44240

Merged
merged 2 commits into from Dec 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion packages/next/build/swc/options.js
Expand Up @@ -115,7 +115,7 @@ function getBaseSWCOptions({
reactRemoveProperties: jest
? false
: nextConfig?.compiler?.reactRemoveProperties,
modularizeImports: nextConfig?.experimental?.modularizeImports,
modularizeImports: nextConfig?.modularizeImports,
relay: nextConfig?.compiler?.relay,
// Always transform styled-jsx and error when `client-only` condition is triggered
styledJsx: true,
Expand Down
3 changes: 2 additions & 1 deletion packages/next/build/webpack-config.ts
Expand Up @@ -2155,6 +2155,7 @@ export default async function getBaseWebpackConfig(
!!config.skipMiddlewareUrlNormalize,
],
['skipTrailingSlashRedirect', !!config.skipTrailingSlashRedirect],
['modularizeImports', !!config.modularizeImports],
SWCBinaryTarget,
].filter<[Feature, boolean]>(Boolean as any)
)
Expand Down Expand Up @@ -2304,7 +2305,7 @@ export default async function getBaseWebpackConfig(
styledComponents: config.compiler?.styledComponents,
relay: config.compiler?.relay,
emotion: config.compiler?.emotion,
modularizeImports: config.experimental?.modularizeImports,
modularizeImports: config.modularizeImports,
legacyBrowsers: config.experimental?.legacyBrowsers,
imageLoaderFile: config.images.loaderFile,
})
Expand Down
2 changes: 2 additions & 0 deletions packages/next/build/webpack/plugins/telemetry-plugin.ts
Expand Up @@ -40,6 +40,7 @@ export type Feature =
| 'transpilePackages'
| 'skipMiddlewareUrlNormalize'
| 'skipTrailingSlashRedirect'
| 'modularizeImports'

interface FeatureUsage {
featureName: Feature
Expand Down Expand Up @@ -102,6 +103,7 @@ const BUILD_FEATURES: Array<Feature> = [
'transpilePackages',
'skipMiddlewareUrlNormalize',
'skipTrailingSlashRedirect',
'modularizeImports',
]

const ELIMINATED_PACKAGES = new Set<string>()
Expand Down
6 changes: 3 additions & 3 deletions packages/next/server/config-schema.ts
Expand Up @@ -310,9 +310,6 @@ const configSchema = {
enum: ['strict', 'flexible'] as any,
type: 'string',
},
modularizeImports: {
type: 'object',
},
newNextLinkBehavior: {
type: 'boolean',
},
Expand Down Expand Up @@ -629,6 +626,9 @@ const configSchema = {
},
type: 'object',
},
modularizeImports: {
type: 'object',
},
onDemandEntries: {
additionalProperties: false,
properties: {
Expand Down
19 changes: 10 additions & 9 deletions packages/next/server/config-shared.ts
Expand Up @@ -120,14 +120,6 @@ export interface ExperimentalConfig {
urlImports?: NonNullable<webpack.Configuration['experiments']>['buildHttp']
outputFileTracingRoot?: string
outputFileTracingIgnores?: string[]
modularizeImports?: Record<
string,
{
transform: string
preventFullImport?: boolean
skipDefaultConversion?: boolean
}
>
swcTraceProfiling?: boolean
forceSwcTransforms?: boolean

Expand Down Expand Up @@ -508,6 +500,15 @@ export interface NextConfig extends Record<string, any> {

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.
*/
Expand Down Expand Up @@ -566,6 +567,7 @@ export const defaultConfig: NextConfig = {
staticPageGenerationTimeout: 60,
swcMinify: true,
output: !!process.env.NEXT_PRIVATE_STANDALONE ? 'standalone' : undefined,
modularizeImports: undefined,
experimental: {
fetchCache: false,
middlewarePrefetch: 'flexible',
Expand Down Expand Up @@ -608,7 +610,6 @@ export const defaultConfig: NextConfig = {
disablePostcssPresetEnv: undefined,
amp: undefined,
urlImports: undefined,
modularizeImports: undefined,
enableUndici: false,
adjustFontFallbacks: false,
adjustFontFallbacksWithSizeAdjust: false,
Expand Down
1 change: 1 addition & 0 deletions packages/next/telemetry/events/build.ts
Expand Up @@ -169,6 +169,7 @@ export type EventBuildFeatureUsage = {
| 'transpilePackages'
| 'skipMiddlewareUrlNormalize'
| 'skipTrailingSlashRedirect'
| 'modularizeImports'
invocationCount: number
}
export function eventBuildFeatureUsage(
Expand Down