Skip to content

Commit

Permalink
Remove experimental.runtime and emit warning when used (#46631)
Browse files Browse the repository at this point in the history
We recommend that users just opt into `edge` per page.
This global default was an unfortunate pattern.
  • Loading branch information
jankaifer authored Mar 6, 2023
1 parent 527afe1 commit 7d5a213
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 19 deletions.
1 change: 0 additions & 1 deletion packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,6 @@ export default async function build(
enableUndici: config.experimental.enableUndici,
locales: config.i18n?.locales,
defaultLocale: config.i18n?.defaultLocale,
pageRuntime: config.experimental.runtime,
})
)

Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/build/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ export async function isPageStatic({
parentId?: any
edgeInfo?: any
pageType?: 'pages' | 'app'
pageRuntime: ServerRuntime
pageRuntime?: ServerRuntime
hasServerComponents?: boolean
originalAppPath?: string
}): Promise<{
Expand Down
13 changes: 1 addition & 12 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,17 +686,7 @@ export default async function getBaseWebpackConfig(
if (isClient) {
if (isEdgeRuntime(config.experimental.runtime)) {
Log.warn(
'You are using the experimental Edge Runtime with `experimental.runtime`.'
)
}
if (config.experimental.runtime === 'nodejs') {
Log.warn(
'You are using the experimental Node.js Runtime with `experimental.runtime`.'
)
}
if (config.experimental.typedRoutes && !hasAppDir) {
Log.warn(
'`experimental.typedRoutes` requires `experimental.appDir` to be enabled.'
'You ase using `experimental.runtime` which was removed. Check https://nextjs.org/docs/api-routes/edge-api-routes on how to use edge runtime.'
)
}
}
Expand Down Expand Up @@ -2392,7 +2382,6 @@ export default async function getBaseWebpackConfig(
reactProductionProfiling,
webpack: !!config.webpack,
hasRewrites,
runtime: config.experimental.runtime,
swcMinify: config.swcMinify,
swcLoader: useSWCLoader,
removeConsole: config.compiler?.removeConsole,
Expand Down
1 change: 0 additions & 1 deletion packages/next/src/export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ export default async function exportApp(
disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,
// Exported pages do not currently support dynamic HTML.
supportsDynamicHTML: false,
runtime: nextConfig.experimental.runtime,
crossOrigin: nextConfig.crossOrigin,
optimizeCss: nextConfig.experimental.optimizeCss,
nextConfigOutput: nextConfig.output,
Expand Down
6 changes: 2 additions & 4 deletions packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,10 @@ export default abstract class Server<ServerOptions extends Options = Options> {
optimizeCss: this.nextConfig.experimental.optimizeCss,
nextConfigOutput: this.nextConfig.output,
nextScriptWorkers: this.nextConfig.experimental.nextScriptWorkers,
disableOptimizedLoading: this.nextConfig.experimental.runtime
? true
: this.nextConfig.experimental.disableOptimizedLoading,
disableOptimizedLoading:
this.nextConfig.experimental.disableOptimizedLoading,
domainLocales: this.nextConfig.i18n?.domains,
distDir: this.distDir,
runtime: this.nextConfig.experimental.runtime,
serverComponents,
crossOrigin: this.nextConfig.crossOrigin
? this.nextConfig.crossOrigin
Expand Down

0 comments on commit 7d5a213

Please sign in to comment.