diff options
author | 2023-07-13 09:21:33 +0100 | |
---|---|---|
committer | 2023-07-13 09:21:33 +0100 | |
commit | f21357b69d94fe8d81f267efddb182d1a3cc678a (patch) | |
tree | fd4d536dffd34ca30d58e6b1e3140576ce3b25fd /packages/integrations/netlify/README.md | |
parent | b30a1bc2b8ad5376dc3e88c185e2ad3979b43ab8 (diff) | |
download | astro-f21357b69d94fe8d81f267efddb182d1a3cc678a.tar.gz astro-f21357b69d94fe8d81f267efddb182d1a3cc678a.tar.zst astro-f21357b69d94fe8d81f267efddb182d1a3cc678a.zip |
feat(@astrojs/netlify): add `build.split` support (#7615)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Diffstat (limited to 'packages/integrations/netlify/README.md')
-rw-r--r-- | packages/integrations/netlify/README.md | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/integrations/netlify/README.md b/packages/integrations/netlify/README.md index 86fff4fd2..5e7895217 100644 --- a/packages/integrations/netlify/README.md +++ b/packages/integrations/netlify/README.md @@ -72,6 +72,24 @@ export default defineConfig({ }); ``` +### Per-page functions + +The Netlify adapter builds to a single function by default. Astro 2.7 added support for splitting your build into separate entry points per page. If you use this configuration, the Netlify adapter will generate a separate function for each page. This can help reduce the size of each function so they are only bundling code used on that page. + +```js +// astro.config.mjs +import { defineConfig } from 'astro/config'; +import netlify from '@astrojs/netlify/functions'; + +export default defineConfig({ + output: 'server', + adapter: netlify(), + build: { + split: true, + }, +}); +``` + ### Static sites For static sites you usually don't need an adapter. However, if you use `redirects` configuration (experimental) in your Astro config, the Netlify adapter can be used to translate this to the proper `_redirects` format. |