0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[Docs]: Update Cloudflare README (#4232)

* update cloudflare readme

* Create modern-papayas-rhyme.md

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
Obinna Ekwuno 2022-08-10 20:11:19 +01:00 committed by GitHub
parent 0af5aa7a3b
commit bfbd32588f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
"@astrojs/cloudflare": patch
---
Update README

View file

@ -27,7 +27,7 @@ Cloudflare Pages has 2 different modes for deploying functions, `advanced` mode
For most projects the adaptor default of `advanced` will be sufficiant, when in this mode the `dist` folder will contain your compiled project. However if you'd like to use [pages plugins](https://developers.cloudflare.com/pages/platform/functions/plugins/) such as [Sentry](https://developers.cloudflare.com/pages/platform/functions/plugins/sentry/) for example to enable logging, you'll need to use directory mode.
In directory mode the adaptor will compile the client side part of you app the same way, but it will move the worker script into a `functions` folder in the project root. The adaptor will only ever place a `[[path]].js` in that folder, allowing you to add additional plugins and pages middlewhere which can be checked into version control .
In directory mode the adaptor will compile the client side part of you app the same way, but it will move the worker script into a `functions` folder in the project root. The adaptor will only ever place a `[[path]].js` in that folder, allowing you to add additional plugins and pages middleware which can be checked into version control.
```ts
// directory mode
@ -45,7 +45,7 @@ In order for preview to work you must install `wrangler`
$ pnpm install wrangler --save-dev
```
It's then possible to update the preview script in your `package.json` to `"preview": "wrangler pages dev ./dist"`
It's then possible to update the preview script in your `package.json` to `"preview": "wrangler pages dev ./dist"`.This will allow you run your entire application locally with [Wrangler](https://github.com/cloudflare/wrangler2), which supports secrets, environment variables, KV namespaces, Durable Objects and [all other supported Cloudflare bindings](https://developers.cloudflare.com/pages/platform/functions/#adding-bindings).
## Streams
@ -54,3 +54,4 @@ Some integrations such as [React](https://github.com/withastro/astro/tree/main/p
In order to work around this:
- install the `"web-streams-polyfill"` package
- add `import "web-streams-polyfill/es2018";` to the top of the front matter of every page which requires streams, such as server rendering a React component.