diff --git a/.changeset/heavy-elephants-tan.md b/.changeset/heavy-elephants-tan.md new file mode 100644 index 000000000..4dc2b8579 --- /dev/null +++ b/.changeset/heavy-elephants-tan.md @@ -0,0 +1,5 @@ +--- +'@astrojs/cloudflare': patch +--- + +Adds `cloudflare:sockets` compile support diff --git a/packages/integrations/cloudflare/README.md b/packages/integrations/cloudflare/README.md index 10a381a7b..a72e2f1d4 100644 --- a/packages/integrations/cloudflare/README.md +++ b/packages/integrations/cloudflare/README.md @@ -357,6 +357,10 @@ import { Buffer } from 'node:buffer'; Additionally, you'll need to enable the Compatibility Flag in Cloudflare. The configuration for this flag may vary based on where you deploy your Astro site. For detailed guidance, please refer to the [Cloudflare documentation on enabling Node.js compatibility](https://developers.cloudflare.com/workers/runtime-apis/nodejs). +## Cloudflare module support + +All Cloudflare namespaced packages (e.g. `cloudflare:sockets`) are allowlisted for use. Note that the package `cloudflare:sockets` does not work locally without using Wrangler dev mode. + ## Preview with Wrangler To use [`wrangler`](https://developers.cloudflare.com/workers/wrangler/) to run your application locally, update the preview script: diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts index 59cd92ce3..c0da2dd74 100644 --- a/packages/integrations/cloudflare/src/index.ts +++ b/packages/integrations/cloudflare/src/index.ts @@ -290,6 +290,7 @@ export default function createIntegration(args?: Options): AstroIntegration { 'node:stream', 'node:string_decoder', 'node:util', + 'cloudflare:*' ], entryPoints: pathsGroup, outbase: absolutePagesDirname, @@ -371,6 +372,7 @@ export default function createIntegration(args?: Options): AstroIntegration { 'node:stream', 'node:string_decoder', 'node:util', + 'cloudflare:*' ], entryPoints: [entryPath], outfile: buildPath,