mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
b012ee55b1
* feat: support adapters and third part integrations by keywords
* refactor: add keywords to all official integrations
* docs: add adapter ex to astro add help
* nit: clarify astro add usage
* nit: highlight link
* fix: use process.exit(1) on error
* chore: changeset
* nit: bold integration name
* fix: log install instructions for adapters instead
* nit: change to logAdapterConfigInstructions
* Revert "fix: log install instructions for adapters instead"
This reverts commit
|
||
---|---|---|
.. | ||
src | ||
CHANGELOG.md | ||
package.json | ||
README.md | ||
tsconfig.json |
@astrojs/cloudflare
An SSR adapter for use with Cloudflare Pages Functions targets. Write your code in Astro/Node and deploy to Cloudflare Pages.
In your astro.config.mjs use:
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';
export default defineConfig({
adapter: cloudflare()
});
Enabling Preview
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"
Streams
Some integrations such as React rely on web streams. Currently Cloudflare Pages functions are in beta and don't support the streams_enable_constructors
feature flag.
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.