Skip to content

Commit adcf6e6

Browse files
authored
Add experimental.strictNextHead to Turbopack (#55915)
This option only has a process.env replacement. Ensures `test/development/client-navigation` can run for Turbopack. <!-- 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 # -->
1 parent 0b74f51 commit adcf6e6

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

packages/next-swc/crates/next-core/src/env.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ pub async fn env_for_js(
6161
map.insert("__NEXT_STRICT_MODE_APP".to_string(), "true".to_string());
6262
}
6363

64+
map.insert(
65+
"__NEXT_STRICT_NEXT_HEAD".to_string(),
66+
if next_config.experimental.strict_next_head.unwrap_or(false) {
67+
"true".to_string()
68+
} else {
69+
"false".to_string()
70+
},
71+
);
72+
6473
if !test_mode.is_empty() {
6574
map.insert("__NEXT_TEST_MODE".to_string(), "true".to_string());
6675
}

packages/next-swc/crates/next-core/src/next_config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ pub enum LoaderItem {
403403
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, TraceRawVcs)]
404404
#[serde(rename_all = "camelCase")]
405405
pub struct ExperimentalConfig {
406+
pub strict_next_head: Option<bool>,
406407
pub server_components_external_packages: Option<Vec<String>>,
407408
pub turbo: Option<ExperimentalTurboConfig>,
408409
pub allowed_revalidate_header_keys: Option<Vec<String>>,

packages/next/src/lib/turbopack-warning.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const supportedTurbopackNextConfigOptions = [
3131
'assetPrefix',
3232
'distDir',
3333
'experimental.serverComponentsExternalPackages',
34+
'experimental.strictNextHead',
3435
'experimental.turbo',
3536
'experimental.mdxRs',
3637
'experimental.forceSwcTransforms',

0 commit comments

Comments
 (0)