Skip to content

Commit

Permalink
Add next.config.js options to turbopack warning file
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Sep 29, 2023
1 parent 590798b commit db39a86
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 42 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Expand Up @@ -67,6 +67,7 @@
"nextjs",
"opentelemetry",
"Threadsafe",
"Turbopack",
"zipkin"
],
"grammarly.selectors": [
Expand Down
2 changes: 0 additions & 2 deletions packages/next-swc/crates/next-core/src/next_config.rs
Expand Up @@ -495,8 +495,6 @@ pub struct ExperimentalConfig {
server_source_maps: Option<bool>,
sri: Option<serde_json::Value>,
swc_minify: Option<bool>,
/// This option is removed
swc_minify_debug_options: Option<()>,
swc_trace_profiling: Option<bool>,
/// @internal Used by the Next.js internals only.
trust_host_header: Option<bool>,
Expand Down
104 changes: 76 additions & 28 deletions packages/next/src/lib/turbopack-warning.ts
Expand Up @@ -4,6 +4,8 @@ import { NextConfig } from '../server/config-shared'
import { PHASE_DEVELOPMENT_SERVER } from '../shared/lib/constants'

const supportedTurbopackNextConfigOptions = [
// options that affect compilation
'output',
'crossOrigin',
'configFileName',
'env',
Expand Down Expand Up @@ -36,37 +38,94 @@ const supportedTurbopackNextConfigOptions = [
'skipMiddlewareUrlNormalize',
'skipTrailingSlashRedirect',
'amp',
'experimental.logging.level',
'devIndicators',
'analyticsId',

// Options that are ignored as they don't affect Turbopack
'webpack',
'onDemandEntries',
'experimental.cpus',

// Experimental options that affect compilation
'experimental.swcPlugins',
'experimental.strictNextHead',
'experimental.manualClientBasePath',
'experimental.optimisticClientCache',
'experimental.middlewarePrefetch',
'experimental.optimizeCss',
'experimental.nextScriptWorkers',
'experimental.optimisticClientCache',
'experimental.webVitalsAttribution',
'experimental.externalMiddlewareRewritesResolve',
'experimental.scrollRestoration',
'experimental.serverComponentsExternalPackages',
'experimental.strictNextHead',
'experimental.turbo',
'experimental.mdxRs',
'experimental.turbo',
'experimental.useDeploymentId',
'experimental.useDeploymentIdServerActions',
'experimental.deploymentId',

// Experimental options that don't affect compilation
'experimental.proxyTimeout',
'experimental.caseSensitiveRoutes',
'experimental.workerThreads',
'experimental.isrFlushToDisk',
'experimental.logging.level',
'experimental.logging.fullUrl',
'experimental.scrollRestoration',
'experimental.forceSwcTransforms',
'experimental.serverActionsBodySizeLimit',
'experimental.memoryBasedWorkersCount',
// options below are not really supported, but ignored
'webpack',
'devIndicators',
'onDemandEntries',
'excludeDefaultMomentLocales',
'experimental.clientRouterFilterRedirects',
'experimental.cpus',
'experimental.proxyTimeout',
'experimental.isrFlushToDisk',
'experimental.workerThreads',
'experimental.caseSensitiveRoutes',
'experimental.webpackBuildWorker',
'experimental.appDocumentPreloading',
'experimental.incrementalCacheHandlerPath',
'experimental.amp',
'experimental.disableOptimizedLoading',
'experimental.isrMemoryCacheSize',
'experimental.largePageDataBytes',
'experimental.gzipSize',

// Left to be implemented
'excludeDefaultMomentLocales',
'experimental.optimizePackageImports',
'experimental.optimizeServerReact',
'experimental.webpackBuildWorker',

// 'compiler.emotion',
// 'compiler.reactRemoveProperties',
// 'compiler.relay',
// 'compiler.removeConsole',
// 'compiler.styledComponents',
// 'experimental.clientRouterFilterAllowedRate',

// clientRouterFilter is `true` by default currently in config-shared.ts,
// might be removed as an option altogether.
'experimental.clientRouterFilter',
'experimental.serverMinification',
'experimental.serverSourceMaps',
'experimental.trustHostHeader',

// 'experimental.adjustFontFallbacks',
// 'experimental.adjustFontFallbacksWithSizeAdjust',
// 'experimental.allowedRevalidateHeaderKeys',
// 'experimental.bundlePagesExternals',
// 'experimental.extensionAlias',
// 'experimental.fallbackNodePolyfills',
// 'experimental.fetchCacheKeyPrefix',
// 'experimental.instrumentationHook',
// 'experimental.ppr',
// 'experimental.serverActions',
// 'experimental.sri.algorithm',
// 'experimental.swcTraceProfiling',
// 'experimental.typedRoutes',

// Might not be needed for Turbopack
// 'experimental.craCompat',
// 'experimental.disablePostcssPresetEnv',
// 'experimental.esmExternals',
// 'experimental.externalDir',
// This is used to force swc-loader to run regardless of finding Babel.
// 'experimental.forceSwcTransforms',
// 'experimental.fullySpecified',
// 'experimental.urlImports',
]

// The following will need to be supported by `next build --turbo`
Expand All @@ -75,30 +134,19 @@ const prodSpecificTurboNextConfigOptions = [
'typescript',
'staticPageGenerationTimeout',
'outputFileTracing',
'output',
'generateBuildId',
'analyticsId',
'compress',
'productionBrowserSourceMaps',
'optimizeFonts',
'poweredByHeader',
'staticPageGenerationTimeout',
'reactProductionProfiling',
'cleanDistDir',
'compiler.reactRemoveProperties',
'compiler.removeConsole',
'experimental.turbotrace',
'experimental.outputFileTracingRoot',
'experimental.outputFileTracingExcludes',
'experimental.outputFileTracingIgnores',
'experiemental.outputFileTracingIncludes',
'experimental.gzipSize',
'experimental.useDeploymentId',
'experimental.useDeploymentIdServerActions',
'experimental.deploymentId',
'experimental.serverMinification',
'experimental.serverSourceMaps',
'experimenta.trustHostHeader',
'experimental.outputFileTracingIncludes',
]

// check for babelrc, swc plugins
Expand Down
4 changes: 0 additions & 4 deletions packages/next/src/server/config-shared.ts
Expand Up @@ -222,10 +222,6 @@ export interface ExperimentalConfig {
swcTraceProfiling?: boolean
forceSwcTransforms?: boolean

/**
* This option is removed
*/
swcMinifyDebugOptions?: never
swcPlugins?: Array<[string, Record<string, unknown>]>
largePageDataBytes?: number
/**
Expand Down
8 changes: 0 additions & 8 deletions packages/next/src/server/config.ts
Expand Up @@ -375,14 +375,6 @@ function assignDefaults(
silent
)

if (typeof result.experimental?.swcMinifyDebugOptions !== 'undefined') {
if (!silent) {
Log.warn(
'SWC minify debug option is not supported anymore, please remove it from your config.'
)
}
}

if ((result.experimental as any).outputStandalone) {
if (!silent) {
Log.warn(
Expand Down

0 comments on commit db39a86

Please sign in to comment.