Unverified Commit 756d6dc9 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

Move immutable static assets config option out of experimental (#95351)

Keep reading `config.experimental.supportsImmutableAssets` for now to
not break existing adapters until they are migrated.

Closes NAR-868
parent 094dccb2
...@@ -174,6 +174,7 @@ pub struct NextConfig { ...@@ -174,6 +174,7 @@ pub struct NextConfig {
typescript: TypeScriptConfig, typescript: TypeScriptConfig,
use_file_system_public_routes: bool, use_file_system_public_routes: bool,
cache_components: Option<bool>, cache_components: Option<bool>,
supports_immutable_assets: Option<bool>,
adapter_path: Option<RcStr>, adapter_path: Option<RcStr>,
// //
...@@ -1291,7 +1292,6 @@ pub struct ExperimentalConfig { ...@@ -1291,7 +1292,6 @@ pub struct ExperimentalConfig {
use_cache: Option<bool>, use_cache: Option<bool>,
durable_use_cache_entries: Option<bool>, durable_use_cache_entries: Option<bool>,
runtime_server_deployment_id: Option<bool>, runtime_server_deployment_id: Option<bool>,
supports_immutable_assets: Option<bool>,
expose_testing_api_in_production_build: Option<bool>, expose_testing_api_in_production_build: Option<bool>,
/// A salt to mix into chunk and asset content hashes. Empty string means /// A salt to mix into chunk and asset content hashes. Empty string means
...@@ -2283,10 +2283,7 @@ impl NextConfig { ...@@ -2283,10 +2283,7 @@ impl NextConfig {
/// Returns the suffix to use for chunk loading. /// Returns the suffix to use for chunk loading.
#[turbo_tasks::function] #[turbo_tasks::function]
pub fn asset_suffix_path(&self) -> Vc<Option<RcStr>> { pub fn asset_suffix_path(&self) -> Vc<Option<RcStr>> {
let needs_dpl_id = self let needs_dpl_id = self.supports_immutable_assets.is_none_or(|f| !f);
.experimental
.supports_immutable_assets
.is_none_or(|f| !f);
Vc::cell( Vc::cell(
needs_dpl_id needs_dpl_id
...@@ -2300,19 +2297,17 @@ impl NextConfig { ...@@ -2300,19 +2297,17 @@ impl NextConfig {
/// .next/immutable-static-hashes.json manifest. /// .next/immutable-static-hashes.json manifest.
#[turbo_tasks::function] #[turbo_tasks::function]
pub fn enable_immutable_assets(&self) -> Vc<bool> { pub fn enable_immutable_assets(&self) -> Vc<bool> {
Vc::cell(self.experimental.supports_immutable_assets == Some(true)) Vc::cell(self.supports_immutable_assets == Some(true))
} }
#[turbo_tasks::function] #[turbo_tasks::function]
pub fn client_static_folder_name(&self) -> Vc<RcStr> { pub fn client_static_folder_name(&self) -> Vc<RcStr> {
Vc::cell( Vc::cell(if self.supports_immutable_assets == Some(true) {
if self.experimental.supports_immutable_assets == Some(true) { // Ends up as `_next/static/immutable`
// Ends up as `_next/static/immutable` rcstr!("static/immutable")
rcstr!("static/immutable") } else {
} else { rcstr!("static")
rcstr!("static") })
},
)
} }
#[turbo_tasks::function] #[turbo_tasks::function]
...@@ -2379,10 +2374,7 @@ impl NextConfig { ...@@ -2379,10 +2374,7 @@ impl NextConfig {
#[turbo_tasks::function] #[turbo_tasks::function]
pub fn should_append_server_deployment_id_at_runtime(&self) -> Vc<bool> { pub fn should_append_server_deployment_id_at_runtime(&self) -> Vc<bool> {
let needs_dpl_id = self let needs_dpl_id = self.supports_immutable_assets.is_none_or(|f| !f);
.experimental
.supports_immutable_assets
.is_none_or(|f| !f);
Vc::cell( Vc::cell(
needs_dpl_id needs_dpl_id
......
...@@ -553,8 +553,7 @@ export async function handleBuildComplete({ ...@@ -553,8 +553,7 @@ export async function handleBuildComplete({
const staticFiles = await recursiveReadDir(path.join(distDir, 'static')) const staticFiles = await recursiveReadDir(path.join(distDir, 'static'))
const clientHashes: Record<string, string> | undefined = const clientHashes: Record<string, string> | undefined =
bundler === Bundler.Turbopack && bundler === Bundler.Turbopack && config.supportsImmutableAssets
config.experimental.supportsImmutableAssets
? JSON.parse( ? JSON.parse(
await fs.readFile( await fs.readFile(
path.join(distDir, 'immutable-static-hashes.json'), path.join(distDir, 'immutable-static-hashes.json'),
......
...@@ -192,7 +192,7 @@ export function getDefineEnv({ ...@@ -192,7 +192,7 @@ export function getDefineEnv({
'process.env.__NEXT_USE_NODE_STREAMS': isEdgeServer ? false : true, 'process.env.__NEXT_USE_NODE_STREAMS': isEdgeServer ? false : true,
'process.env.NEXT_SUPPORTS_IMMUTABLE_ASSETS': 'process.env.NEXT_SUPPORTS_IMMUTABLE_ASSETS':
config.experimental.supportsImmutableAssets || false, config.supportsImmutableAssets || false,
...(config.experimental?.useSkewCookie || !config.deploymentId ...(config.experimental?.useSkewCookie || !config.deploymentId
? { ? {
......
...@@ -866,7 +866,7 @@ export function createStaticWorker( ...@@ -866,7 +866,7 @@ export function createStaticWorker(
: undefined), : undefined),
// worker.ts copies this value into globalThis.NEXT_CLIENT_ASSET_SUFFIX // worker.ts copies this value into globalThis.NEXT_CLIENT_ASSET_SUFFIX
__NEXT_PRERENDER_CLIENT_ASSET_SUFFIX: __NEXT_PRERENDER_CLIENT_ASSET_SUFFIX:
config.experimental.supportsImmutableAssets || !config.deploymentId config.supportsImmutableAssets || !config.deploymentId
? '' ? ''
: `?dpl=${config.deploymentId}`, : `?dpl=${config.deploymentId}`,
}, },
...@@ -2146,7 +2146,7 @@ export default async function build( ...@@ -2146,7 +2146,7 @@ export default async function build(
cacheLifeProfiles: config.cacheLife, cacheLifeProfiles: config.cacheLife,
buildId, buildId,
deploymentId: config.deploymentId, deploymentId: config.deploymentId,
clientAssetToken: config.experimental.supportsImmutableAssets clientAssetToken: config.supportsImmutableAssets
? '' ? ''
: config.deploymentId, : config.deploymentId,
sriEnabled, sriEnabled,
...@@ -2379,8 +2379,7 @@ export default async function build( ...@@ -2379,8 +2379,7 @@ export default async function build(
cacheLifeProfiles: config.cacheLife, cacheLifeProfiles: config.cacheLife,
buildId, buildId,
deploymentId: config.deploymentId, deploymentId: config.deploymentId,
clientAssetToken: config.experimental clientAssetToken: config.supportsImmutableAssets
.supportsImmutableAssets
? '' ? ''
: config.deploymentId, : config.deploymentId,
sriEnabled, sriEnabled,
......
...@@ -715,7 +715,7 @@ async function exportAppImpl( ...@@ -715,7 +715,7 @@ async function exportAppImpl(
worker.exportPages({ worker.exportPages({
buildId, buildId,
deploymentId: nextConfig.deploymentId, deploymentId: nextConfig.deploymentId,
clientAssetToken: nextConfig.experimental.supportsImmutableAssets clientAssetToken: nextConfig.supportsImmutableAssets
? '' ? ''
: nextConfig.deploymentId, : nextConfig.deploymentId,
exportPaths: batch, exportPaths: batch,
......
...@@ -496,7 +496,7 @@ export default abstract class Server< ...@@ -496,7 +496,7 @@ export default abstract class Server<
process.env.NEXT_DEPLOYMENT_ID = id process.env.NEXT_DEPLOYMENT_ID = id
} }
;(globalThis as any).NEXT_CLIENT_ASSET_SUFFIX = ;(globalThis as any).NEXT_CLIENT_ASSET_SUFFIX =
this.nextConfig.experimental.supportsImmutableAssets || !this.deploymentId this.nextConfig.supportsImmutableAssets || !this.deploymentId
? '' ? ''
: `?dpl=${this.deploymentId}` : `?dpl=${this.deploymentId}`
......
...@@ -594,6 +594,7 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() => ...@@ -594,6 +594,7 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
.union([z.literal('anonymous'), z.literal('use-credentials')]) .union([z.literal('anonymous'), z.literal('use-credentials')])
.optional(), .optional(),
deploymentId: z.string().optional(), deploymentId: z.string().optional(),
supportsImmutableAssets: z.boolean().optional(),
devIndicators: z devIndicators: z
.union([ .union([
z.object({ z.object({
......
...@@ -1364,9 +1364,7 @@ export interface ExperimentalConfig { ...@@ -1364,9 +1364,7 @@ export interface ExperimentalConfig {
runtimeServerDeploymentId?: boolean runtimeServerDeploymentId?: boolean
/** /**
* Whether the deployment environment supports immutable assets (assets deployed to * @deprecated Use the top-level `supportsImmutableAssets` option instead.
* `_next/static/immutable` don't need a `?dpl` parameter and can be safely requested across
* deployments.)
*/ */
supportsImmutableAssets?: boolean supportsImmutableAssets?: boolean
...@@ -1692,6 +1690,13 @@ export interface NextConfig { ...@@ -1692,6 +1690,13 @@ export interface NextConfig {
*/ */
deploymentId?: string deploymentId?: string
/**
* Whether the deployment environment supports immutable assets (assets deployed to
* `_next/static/immutable` don't need a `?dpl` parameter and can be safely requested across
* deployments.)
*/
supportsImmutableAssets?: boolean
/** /**
* Deploy a Next.js application under a sub-path of a domain * Deploy a Next.js application under a sub-path of a domain
* *
...@@ -2235,6 +2240,7 @@ export async function normalizeConfig(phase: string, config: any) { ...@@ -2235,6 +2240,7 @@ export async function normalizeConfig(phase: string, config: any) {
export interface NextConfigRuntime { export interface NextConfigRuntime {
// Can be undefined, particularly when experimental.runtimeServerDeploymentId is true // Can be undefined, particularly when experimental.runtimeServerDeploymentId is true
deploymentId?: NextConfigComplete['deploymentId'] deploymentId?: NextConfigComplete['deploymentId']
supportsImmutableAssets?: NextConfigComplete['supportsImmutableAssets']
configFileName?: string configFileName?: string
// Should only be included when using isExperimentalCompile // Should only be included when using isExperimentalCompile
...@@ -2313,7 +2319,6 @@ export interface NextConfigRuntime { ...@@ -2313,7 +2319,6 @@ export interface NextConfigRuntime {
| 'maxPostponedStateSize' | 'maxPostponedStateSize'
| 'cachedNavigations' | 'cachedNavigations'
| 'exposeTestingApiInProductionBuild' | 'exposeTestingApiInProductionBuild'
| 'supportsImmutableAssets'
| 'instantInsights' | 'instantInsights'
| 'requestInsights' | 'requestInsights'
> & { > & {
...@@ -2383,7 +2388,6 @@ export function getNextConfigRuntime( ...@@ -2383,7 +2388,6 @@ export function getNextConfigRuntime(
maxPostponedStateSize: ex.maxPostponedStateSize, maxPostponedStateSize: ex.maxPostponedStateSize,
cachedNavigations: ex.cachedNavigations, cachedNavigations: ex.cachedNavigations,
exposeTestingApiInProductionBuild: ex.exposeTestingApiInProductionBuild, exposeTestingApiInProductionBuild: ex.exposeTestingApiInProductionBuild,
supportsImmutableAssets: ex.supportsImmutableAssets,
instantInsights: ex.instantInsights, instantInsights: ex.instantInsights,
requestInsights: ex.requestInsights, requestInsights: ex.requestInsights,
...@@ -2395,6 +2399,7 @@ export function getNextConfigRuntime( ...@@ -2395,6 +2399,7 @@ export function getNextConfigRuntime(
deploymentId: config.experimental.runtimeServerDeploymentId deploymentId: config.experimental.runtimeServerDeploymentId
? '' ? ''
: config.deploymentId, : config.deploymentId,
supportsImmutableAssets: config.supportsImmutableAssets,
configFileName: undefined, configFileName: undefined,
env: undefined, env: undefined,
......
...@@ -1634,7 +1634,10 @@ function assignDefaultsAndValidate( ...@@ -1634,7 +1634,10 @@ function assignDefaultsAndValidate(
* consumers don't each need to know the current framework default (which may * consumers don't each need to know the current framework default (which may
* evolve over time). * evolve over time).
*/ */
function finalizeConfig(config: NextConfigComplete): NextConfigComplete { function finalizeConfig(
config: NextConfigComplete,
bundler: Bundler | undefined
): NextConfigComplete {
config.experimental.instantInsights = { config.experimental.instantInsights = {
validationLevel: validationLevel:
config.experimental.instantInsights?.validationLevel ?? 'warning', config.experimental.instantInsights?.validationLevel ?? 'warning',
...@@ -1648,18 +1651,34 @@ function finalizeConfig(config: NextConfigComplete): NextConfigComplete { ...@@ -1648,18 +1651,34 @@ function finalizeConfig(config: NextConfigComplete): NextConfigComplete {
config.deploymentId && config.deploymentId &&
process.env.__NEXT_SUPPORTS_IMMUTABLE_ASSETS process.env.__NEXT_SUPPORTS_IMMUTABLE_ASSETS
) { ) {
config.experimental.supportsImmutableAssets = true config.supportsImmutableAssets = true
} }
// Normalize again for Adapters that only set config.experimental.supportsImmutableAssets for now.
if ( if (
config.experimental.supportsImmutableAssets && config.supportsImmutableAssets !==
config.experimental?.supportsImmutableAssets
) {
config.supportsImmutableAssets =
config.supportsImmutableAssets ??
config.experimental?.supportsImmutableAssets
}
if (bundler !== undefined && bundler !== Bundler.Turbopack) {
// Silently ignore that flag for Webpack/Rspack since the server code assumes that all files
// in `static/chunks` are always immutable without checking the manifest.
config.supportsImmutableAssets = false
}
if (
config.supportsImmutableAssets &&
(config.output === 'export' || config.output === 'standalone') (config.output === 'export' || config.output === 'standalone')
) { ) {
// supportsImmutableAssets is designed to work with adapters. Disable it for output=export and // supportsImmutableAssets is designed to work with adapters. Disable it for output=export and
// output=standalone, which are currently using a non-adapter codepath. // output=standalone, which are currently using a non-adapter codepath.
// Particularly output=export should just run through the adapter, with only static assets. // Particularly output=export should just run through the adapter, with only static assets.
// TODO remove again once output=export (and output=standalone) are using adapters. // TODO remove again once output=export (and output=standalone) are using adapters.
config.experimental.supportsImmutableAssets = false config.supportsImmutableAssets = false
} }
return config return config
...@@ -1888,7 +1907,8 @@ async function loadConfigImpl( ...@@ -1888,7 +1907,8 @@ async function loadConfigImpl(
phase, phase,
silent, silent,
dir dir
) ),
bundler
) )
// Cache the custom config result // Cache the custom config result
...@@ -2000,6 +2020,14 @@ async function loadConfigImpl( ...@@ -2000,6 +2020,14 @@ async function loadConfigImpl(
// Check deprecation warnings on the actual user config before merging with defaults // Check deprecation warnings on the actual user config before merging with defaults
checkDeprecations(userConfig, configFileName, silent, dir) checkDeprecations(userConfig, configFileName, silent, dir)
if (
userConfig.supportsImmutableAssets === undefined &&
userConfig.experimental?.supportsImmutableAssets !== undefined
) {
userConfig.supportsImmutableAssets =
userConfig.experimental.supportsImmutableAssets
}
// Always validate the config against schema in non minimal mode // Always validate the config against schema in non minimal mode
if (!process.env.NEXT_MINIMAL && !silent) { if (!process.env.NEXT_MINIMAL && !silent) {
await validateConfigSchema( await validateConfigSchema(
...@@ -2023,16 +2051,6 @@ async function loadConfigImpl( ...@@ -2023,16 +2051,6 @@ async function loadConfigImpl(
) )
} }
if (
userConfig.experimental?.supportsImmutableAssets &&
bundler !== undefined &&
bundler !== Bundler.Turbopack
) {
// Silently ignore that flag for Webpack/Rspack since the server code assumes that all files
// in `static/chunks` are always immutable without checking the manifest.
userConfig.experimental.supportsImmutableAssets = undefined
}
if (reactProductionProfiling) { if (reactProductionProfiling) {
userConfig.reactProductionProfiling = reactProductionProfiling userConfig.reactProductionProfiling = reactProductionProfiling
} }
...@@ -2092,9 +2110,23 @@ async function loadConfigImpl( ...@@ -2092,9 +2110,23 @@ async function loadConfigImpl(
) )
const finalConfig = finalizeConfig( const finalConfig = finalizeConfig(
await applyModifyConfig(completeConfig, phase, silent, dir) await applyModifyConfig(completeConfig, phase, silent, dir),
bundler
) )
// Normalize so that also Adapters can still see userConfig.experimental.supportsImmutableAssets for now
if (
userConfig.supportsImmutableAssets === undefined ||
userConfig.experimental?.supportsImmutableAssets === undefined
) {
const value =
userConfig.supportsImmutableAssets ??
userConfig.experimental?.supportsImmutableAssets
userConfig.supportsImmutableAssets = value
userConfig.experimental ??= {}
userConfig.experimental.supportsImmutableAssets = value
}
// Cache the final result // Cache the final result
configCache.set(cacheKey, { configCache.set(cacheKey, {
config: finalConfig, config: finalConfig,
...@@ -2151,7 +2183,8 @@ async function loadConfigImpl( ...@@ -2151,7 +2183,8 @@ async function loadConfigImpl(
setHttpClientAndAgentOptions(completeConfig) setHttpClientAndAgentOptions(completeConfig)
const finalConfig = finalizeConfig( const finalConfig = finalizeConfig(
await applyModifyConfig(completeConfig, phase, silent, dir) await applyModifyConfig(completeConfig, phase, silent, dir),
bundler
) )
// Cache the default config result // Cache the default config result
......
...@@ -522,7 +522,7 @@ export function getResolveRoutes( ...@@ -522,7 +522,7 @@ export function getResolveRoutes(
config.deploymentId config.deploymentId
) { ) {
let isImmutableFile = let isImmutableFile =
config.experimental.supportsImmutableAssets && config.supportsImmutableAssets &&
clientHashes![`static${decodeURI(output.itemPath)}`] clientHashes![`static${decodeURI(output.itemPath)}`]
// Service workers are served at a fixed, stable URL (so the browser can keep the // Service workers are served at a fixed, stable URL (so the browser can keep the
// same registration across builds), so they don't carry a `?dpl` token. // same registration across builds), so they don't carry a `?dpl` token.
......
...@@ -655,8 +655,7 @@ export default class NextNodeServer extends BaseServer< ...@@ -655,8 +655,7 @@ export default class NextNodeServer extends BaseServer<
{ {
buildId: this.buildId, buildId: this.buildId,
deploymentId: this.deploymentId, deploymentId: this.deploymentId,
clientAssetToken: this.nextConfig.experimental clientAssetToken: this.nextConfig.supportsImmutableAssets
.supportsImmutableAssets
? '' ? ''
: this.deploymentId, : this.deploymentId,
} }
...@@ -674,8 +673,7 @@ export default class NextNodeServer extends BaseServer< ...@@ -674,8 +673,7 @@ export default class NextNodeServer extends BaseServer<
{ {
buildId: this.buildId, buildId: this.buildId,
deploymentId: this.deploymentId, deploymentId: this.deploymentId,
clientAssetToken: this.nextConfig.experimental clientAssetToken: this.nextConfig.supportsImmutableAssets
.supportsImmutableAssets
? undefined ? undefined
: this.deploymentId, : this.deploymentId,
customServer: this.serverOptions.customServer || undefined, customServer: this.serverOptions.customServer || undefined,
...@@ -1770,7 +1768,7 @@ export default class NextNodeServer extends BaseServer< ...@@ -1770,7 +1768,7 @@ export default class NextNodeServer extends BaseServer<
request: requestData, request: requestData,
useCache: true, useCache: true,
onWarning: params.onWarning, onWarning: params.onWarning,
clientAssetToken: this.nextConfig.experimental.supportsImmutableAssets clientAssetToken: this.nextConfig.supportsImmutableAssets
? '' ? ''
: this.deploymentId, : this.deploymentId,
}) })
...@@ -2092,7 +2090,7 @@ export default class NextNodeServer extends BaseServer< ...@@ -2092,7 +2090,7 @@ export default class NextNodeServer extends BaseServer<
params.req, params.req,
'serverComponentsHmrCache' 'serverComponentsHmrCache'
), ),
clientAssetToken: this.nextConfig.experimental.supportsImmutableAssets clientAssetToken: this.nextConfig.supportsImmutableAssets
? '' ? ''
: this.deploymentId, : this.deploymentId,
}) })
......
...@@ -308,7 +308,7 @@ export type PagesSharedContext = { ...@@ -308,7 +308,7 @@ export type PagesSharedContext = {
deploymentId: string | undefined deploymentId: string | undefined
/** /**
* NextConfig.deploymentId if experimental.supportsImmutableAssets is not true, otherwise undefined. * NextConfig.deploymentId if supportsImmutableAssets is not true, otherwise undefined.
*/ */
clientAssetToken: string | undefined clientAssetToken: string | undefined
......
...@@ -1094,9 +1094,7 @@ export abstract class RouteModule< ...@@ -1094,9 +1094,7 @@ export abstract class RouteModule<
nextConfig satisfies DeepReadonly<NextConfigRuntime> as NextConfigRuntime, nextConfig satisfies DeepReadonly<NextConfigRuntime> as NextConfigRuntime,
routerServerContext, routerServerContext,
deploymentId, deploymentId,
clientAssetToken: nextConfig.experimental.supportsImmutableAssets clientAssetToken: nextConfig.supportsImmutableAssets ? '' : deploymentId,
? ''
: deploymentId,
} }
} }
......
...@@ -6,6 +6,7 @@ import { Span } from 'next/dist/trace' ...@@ -6,6 +6,7 @@ import { Span } from 'next/dist/trace'
import stripAnsi from 'strip-ansi' import stripAnsi from 'strip-ansi'
import { quote as shellQuote } from 'shell-quote' import { quote as shellQuote } from 'shell-quote'
import { shouldUseTurbopack } from 'next-test-utils' import { shouldUseTurbopack } from 'next-test-utils'
import { RequiredServerFilesManifest } from 'next/dist/build'
export class NextStartInstance extends NextInstance { export class NextStartInstance extends NextInstance {
private _buildId: string private _buildId: string
...@@ -171,12 +172,11 @@ export class NextStartInstance extends NextInstance { ...@@ -171,12 +172,11 @@ export class NextStartInstance extends NextInstance {
), ),
'utf8' 'utf8'
) )
) ) as RequiredServerFilesManifest
this._deploymentId = this._deploymentId =
requiredServerFiles.config?.deploymentId || undefined requiredServerFiles.config?.deploymentId || undefined
this._supportsImmutableAssets = this._supportsImmutableAssets =
requiredServerFiles.config?.experimental?.supportsImmutableAssets || requiredServerFiles.config?.supportsImmutableAssets || false
false
} catch {} } catch {}
} }
...@@ -330,8 +330,7 @@ export class NextStartInstance extends NextInstance { ...@@ -330,8 +330,7 @@ export class NextStartInstance extends NextInstance {
) )
this._deploymentId = requiredServerFiles.config?.deploymentId || undefined this._deploymentId = requiredServerFiles.config?.deploymentId || undefined
this._supportsImmutableAssets = this._supportsImmutableAssets =
requiredServerFiles.config?.experimental?.supportsImmutableAssets || requiredServerFiles.config?.supportsImmutableAssets || false
false
} catch {} } catch {}
return result return result
......
...@@ -39,6 +39,7 @@ import escapeRegex from 'escape-string-regexp' ...@@ -39,6 +39,7 @@ import escapeRegex from 'escape-string-regexp'
import './add-redbox-matchers' import './add-redbox-matchers'
import { NextInstance } from 'e2e-utils' import { NextInstance } from 'e2e-utils'
import { ClientReferenceManifest } from 'next/dist/build/webpack/plugins/flight-manifest-plugin' import { ClientReferenceManifest } from 'next/dist/build/webpack/plugins/flight-manifest-plugin'
import { RequiredServerFilesManifest } from 'next/dist/build'
export { shouldUseTurbopack } export { shouldUseTurbopack }
...@@ -2124,7 +2125,7 @@ export const getCacheHeader = (curRes: Response) => ...@@ -2124,7 +2125,7 @@ export const getCacheHeader = (curRes: Response) =>
curRes.headers.get('x-nextjs-cache') || curRes.headers.get('x-vercel-cache') curRes.headers.get('x-nextjs-cache') || curRes.headers.get('x-vercel-cache')
export function getDeploymentId(appDir: string, isDev: boolean) { export function getDeploymentId(appDir: string, isDev: boolean) {
let requiredServerFiles let requiredServerFiles: RequiredServerFilesManifest | undefined
if (!isDev) { if (!isDev) {
// File isn't written in dev, but it might still exist because it was created by a prior // File isn't written in dev, but it might still exist because it was created by a prior
// production build. // production build.
...@@ -2142,7 +2143,7 @@ export function getDeploymentId(appDir: string, isDev: boolean) { ...@@ -2142,7 +2143,7 @@ export function getDeploymentId(appDir: string, isDev: boolean) {
requiredServerFiles?.config?.deploymentId requiredServerFiles?.config?.deploymentId
const assetToken: string | undefined = requiredServerFiles?.config const assetToken: string | undefined = requiredServerFiles?.config
?.experimental?.supportsImmutableAssets ?.supportsImmutableAssets
? undefined ? undefined
: deploymentId : deploymentId
......
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