Repository navigation
Use OPEN_NEXT_CLOUDFLARE from Cloudflare open-next adapter #8018
Copy link
Copy link
Open
Labels
Description
The open-next adapter should introduce an OPEN_NEXT_CLOUDFLARE environment variable that the site should be used to detect when it is targeting Cloudflare as its deploying platform.
Currently this type of detection is done in less ideal ways in a few different places:
nodejs.org/packages/rehype-shiki/src/index.mjs
Lines 29 to 36 in 331ad08
| // TODO(@avivkeller): When available, use `OPEN_NEXT_CLOUDFLARE` environmen | |
| // variable for detection instead of current method, which will enable better | |
| // tree-shaking. | |
| // Reference: https://github.com/nodejs/nodejs.org/pull/7896#issuecomment-3009480615 | |
| engine: | |
| 'Cloudflare' in globalThis | |
| ? createJavaScriptRegexEngine() | |
| : await createOnigurumaEngine(import('shiki/wasm')), |
nodejs.org/apps/site/next.config.mjs
Lines 99 to 108 in f02327a
| // If we're building for the Cloudflare deployment we want to set | |
| // an appropriate deploymentId (needed for skew protection) | |
| // TODO: The `OPEN_NEXT_CLOUDFLARE` environment variable is being | |
| // defined in the worker building script, ideally the open-next | |
| // adapter should set it itself when it invokes the Next.js build | |
| // process, onces it does that remove the manual `OPEN_NEXT_CLOUDFLARE` | |
| // definition in the package.json script. | |
| deploymentId: process.env.OPEN_NEXT_CLOUDFLARE | |
| ? getDeploymentId() | |
| : undefined, |
nodejs.org/apps/site/package.json
Line 10 in f02327a
| "cloudflare:build:worker": "OPEN_NEXT_CLOUDFLARE=true opennextjs-cloudflare build", |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields📋 Backlog
Activity
avivkeller commentedon Sep 1, 2025
@dario-piotrowicz What's the progress on this being available in Open-Next?
dario-piotrowicz commentedon Sep 1, 2025
@avivkeller not much progress here, I actually haven't worked on it yet, if this is problematic/blocking and/or you think it should be fixes ASAP I am happy to prioritize this and look into it sooner (in the next few days)
avivkeller commentedon Sep 1, 2025
No problem, there isn't a priority, nothing is broken