Skip to content

Commit

Permalink
Add next.config.js options to turbopack warning file (#56207)
Browse files Browse the repository at this point in the history
Went through all options listed in config-shared.ts and added them to
the turbopack warning file so that there is a clear list of what is not
implemented yet.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
  • Loading branch information
timneutkens committed Sep 29, 2023
1 parent 590798b commit 7cb8887
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 42 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
105 changes: 77 additions & 28 deletions packages/next/src/lib/turbopack-warning.ts
Original file line number Diff line number Diff line change
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,95 @@ 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',
'experimental.trustHostHeader',

// Left to be implemented (priority)
// 'experimental.serverActions',
// 'experimental.ppr', // Checked in `needs-experimental-react.ts`
// clientRouterFilter is `true` by default currently in config-shared.ts,
// might be removed as an option altogether.
'experimental.clientRouterFilter',
'experimental.optimizePackageImports',
// 'compiler.emotion',
// 'compiler.reactRemoveProperties',
// 'compiler.relay',
// 'compiler.removeConsole',
// 'compiler.styledComponents',
// 'experimental.fetchCacheKeyPrefix',
// 'experimental.instrumentationHook',

// Left to be implemented
'excludeDefaultMomentLocales',
'experimental.optimizeServerReact',
'experimental.webpackBuildWorker',
// 'experimental.clientRouterFilterAllowedRate',
'experimental.serverMinification',
'experimental.serverSourceMaps',

// 'experimental.adjustFontFallbacks',
// 'experimental.adjustFontFallbacksWithSizeAdjust',
// 'experimental.allowedRevalidateHeaderKeys',
// 'experimental.bundlePagesExternals',
// 'experimental.extensionAlias',
// 'experimental.fallbackNodePolyfills',

// 'experimental.sri.algorithm',
// 'experimental.swcTraceProfiling',
// 'experimental.typedRoutes',

// Left to be implemented (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 +135,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 7cb8887

Please sign in to comment.