fix(cloudflare): support for 'cloudflare:*' imports (#8766)
* chore: add 'cloudflare:sockets' to external list * chore: add Changeset * patch: wildcard cloudflare packages * chore: updated Readme for cloudflare module support * Update .changeset/heavy-elephants-tan.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update packages/integrations/cloudflare/README.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> Co-authored-by: Alexander Niebuhr <alexander@nbhr.io>
This commit is contained in:
parent
7ea27f6319
commit
054c5c6447
3 changed files with 11 additions and 0 deletions
5
.changeset/heavy-elephants-tan.md
Normal file
5
.changeset/heavy-elephants-tan.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@astrojs/cloudflare': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Adds `cloudflare:sockets` compile support
|
|
@ -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).
|
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
|
## Preview with Wrangler
|
||||||
|
|
||||||
To use [`wrangler`](https://developers.cloudflare.com/workers/wrangler/) to run your application locally, update the preview script:
|
To use [`wrangler`](https://developers.cloudflare.com/workers/wrangler/) to run your application locally, update the preview script:
|
||||||
|
|
|
@ -290,6 +290,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
||||||
'node:stream',
|
'node:stream',
|
||||||
'node:string_decoder',
|
'node:string_decoder',
|
||||||
'node:util',
|
'node:util',
|
||||||
|
'cloudflare:*'
|
||||||
],
|
],
|
||||||
entryPoints: pathsGroup,
|
entryPoints: pathsGroup,
|
||||||
outbase: absolutePagesDirname,
|
outbase: absolutePagesDirname,
|
||||||
|
@ -371,6 +372,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
||||||
'node:stream',
|
'node:stream',
|
||||||
'node:string_decoder',
|
'node:string_decoder',
|
||||||
'node:util',
|
'node:util',
|
||||||
|
'cloudflare:*'
|
||||||
],
|
],
|
||||||
entryPoints: [entryPath],
|
entryPoints: [entryPath],
|
||||||
outfile: buildPath,
|
outfile: buildPath,
|
||||||
|
|
Loading…
Reference in a new issue