feat(cloudflare): generated wrangler configuration#2949
Conversation
|
Given this is using the cloudflare_pages plugin, this should not have an This is likely to break the Pages CI. Not a problem in real life because the user wouldn't have that. But in terms of testing, I will remove that from the wrangler.toml |
|
For Pages projects that have a Depending on what you want the DX, you could either require the user to add that field themselves, or you could add it as part of the generation of |
Nitro has introduced an experimental (opt-in) way to generate/extend
wrangler.tomlfor cloudflare deployments (#2353, #2355) (However, overwriting the user config is not ideal or recommended, so it remain experimental)The end goal is to leverage Cloudflare platform features such as Node compat v2 (hybrid) and Async Context with zero-config and ensure we can reliably enable these features.
Thanks to the huge huge efforts and collab with the Cloudflare team and @petebacondarwin, a new solution (~> cloudflare/workers-sdk#7442) is coming to allow frameworks like Nitro to generate a merged
wrangler.tomlin dist and config that redirects/points wrangler CLI and pages CI to it.Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#generated-wrangler-configuration
Remarks
cloudflare.noWranglerDeployConfig: truecan be used to opt-out from generating deploy-config in.wrangler/deploy/config.jsonwrangler.toml|jsonis read and always merged with the highest precedencecloudflare.wranglerobjectcompatibility_datedefaults tocompatibilityDatefrom framework configcompatibility_flagsdefaults to["nodejs_compat", "no_nodejs_compat_v2"]Pages
pnpm nitro build playground --preset cloudflare_pagesdist/_worker.js/wrangler.json:{ "compatibility_date": "2024-09-19", "pages_build_output_dir": ".." }Modules
pnpm nitro build playground --preset cloudflare_module.output/server/wrangler.json:{ "compatibility_date": "2024-09-19", "main": "index.mjs", "assets": { "binding": "ASSETS", "directory": "../public" } }