-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Open
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", |
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
📋 Backlog