- #388
3f280f1
Thanks @hrishikesh-k! - Allows-
in hostnames for Netlify Image CDN RegEx
-
#350
2248bc7
Thanks @matthewp! - Apply polyfills immediately on function executionThis moves up when the polyfills are applied so that they are present before Astro runs, preventing a race condition that can cause
crypto
to not be defined early enough in Node 18.
- #315
a45eb36
Thanks @eduardoboucas! - Refactors the adapter to use the Netlify Frameworks API
- #286
e2ecf64
Thanks @theoephraim! - Allows support fornode:
prefixed imports if using the Adapter withedgeMiddleware: true
- #316
d81806a
Thanks @ascorbic! - Fixes a regression where edge middleware tried to bundle node builtins
- #313
55a3e1a
Thanks @ascorbic! - Fixes an issue where files were not included in the SSR function when built in a monorepo
- #296
8a00cad
Thanks @ascorbic! - Improves performance for serverless function builds by not bundling dependencies
- #293
ee840fa
Thanks @florian-lefebvre! - Fixesastro:env
getSecret compatibility
- #282
65337f3
Thanks @alexanderniebuhr! - Fixes backwards compatibility with Astro <= 4.9
- #275
4a28bf6
Thanks @florian-lefebvre! - Adds support for experimentalastro:env
released in Astro 4.10
- #255
3fa962d
Thanks @ascorbic! - Fixes an issue with edge middleware whereprocess.env
was not defined, by using a polyfill to shim it
- #187
79ebfa4c9e2f84309edb35481ad9cd1f3c7e5eb4
Thanks @ascorbic! - Adds support forimage.remotePatterns
andimages.domains
with Netlify Image CDN
- #163
bc9ee99c7333ae29e4d4184059c09650330fd0d9
Thanks @OiYouYeahYou! - Fixes an issue where some astro CLI commands failed withcrypto is not defined
on Astro 4.4.0 and earlier.
- #160
994985547c2d2bc8c66b76f996257e68f8187a14
Thanks @lilnasy! - Fixes an issue where enablingedgeMiddleware
failed to bundle a dependency (cssesc
) introduced in Astro 4.2.5.
- #162
07217c07e89d4596b464d05c4873e7039aa616f4
Thanks @Skn0tt! - Fixes bug where prerendered 404 pages were served astext/plain
instead oftext/html
for hybrid/server apps, leading to browsers displaying source code instead of rendering it
-
#152
816bdc42e0665904e418dd0137bd6a7c8c74307f
Thanks @lilnasy! - Implements verification for edge middleware. This is a security measure to ensure that your serverless functions are only ever called by your edge middleware and not by a third party.When
edgeMiddleware
is enabled, the serverless function will now respond with403 Forbidden
for requests that are not verified to have come from the generated edge middleware. No user action is necessary.
- #143
06bae52f26d1df1368581aa859f332141db00c1b
Thanks @Skn0tt! - Fixes a bug in the Netlify Adapter where prerendered 404.astro pages weren't shown on hybrid/server deployments.
- #130
2b5aaa4cfeda4bc7f1bf8db6210162c495866a95
Thanks @asdfjkalsdfla! - Updates the internals of the integration to support Astro 4.0. See this upstream pull request for additional details. Warning: Make sure to upgrade your Astro version to>4.2
as previous versions are no longer supported.
- #127
36434f0c631cb963c748a11679cf7a96cd605d8e
Thanks @Skn0tt! - Updates the behavior of thecacheOnDemandPages
setting to only cache GET/HEAD requests by default
- #117
89f7c01
Thanks @alexanderniebuhr! - Updates Netlify README.md
-
#84
ca64544
Thanks @Skn0tt! - # Netlify Adapter v4 simplifies static + SSR deploymentsThis update is a complete overhaul of the Netlify adapter. It simplifies the user-facing config, and resolves a number of bugs along the way.
Here's what changes:
In v3, you could use
netlify-edge-middleware.ts
to inject data from the Netlify context into your Astro locals. In v4, this file is no longer needed because the Netlify context is automatically made available viaAstro.locals.netlify.context
. You can use this context to access information about the user (like geolocation or IP address), your Netlify site (like deploy ID) or the request (like its request ID or the CDN region it's served from).Action Required: Remove the
netlify-edge-middleware.ts
ornetlify-edge-middleware.js
file. In your codebase, change all usage of locals injected through that file to useAstro.locals.netlify.context
instead.v4 of this adapter integrates your Astro site with Netlify Image CDN. This allows transforming images on-the-fly without impacting build times. It's implemented using an Astro Image Service, and enabled by default.
On-Demand Builders (ODB) allows SSR-Rendered pages to be cached using a Time to Live (TTL) strategy. While the Netlify platform continues to support existing pages with ODBs, we now recommend using the much more powerful Fine-Grained Cache Control going forward.
In v3, you could deploy your SSR-Rendered Astro pages to ODBs by enabling the
builders
config option, and then specifying the TTL on a per-page basis. In v4, a newcacheOnDemandPages
option replaces this config option. Take a look at the README to learn more about this.Action Required: Replace the
builders
config option withcacheOnDemandPages
.// astro.config.mjs export default defineConfig({ // ... adapter: netlify({ - builders: true + cacheOnDemandPages: true }), });
In v3, the
functionPerRoute
option allowed the SSR routes to be split up into multiple Netlify Functions. This reduced the bundle sizes of each individual function, with the intention of speeding up code parsing, and therefore the time of cold starts. In practice, this benefit is often nullified by the increase in number of cold starts - more handlers means fewer requests per handler, means more cold starts.In v4, support for this deployment mode was removed.
Action Required: Remove the
functionPerRoute
field from your config.binaryMediaTypes
was a workaround required for some Astro endpoints, because v3 deployed those as "old" Netlify Functions (now referred to as "Lambda Compatibility Mode"). v4 uses the new Netlify Functions 2.0, which simply doesn't need this workaround anymore - so we're removing it 🎉Action Required: Remove the
binaryMediaTypes
field from your config.
- #100
1195955
Thanks @Jinksi! - Fixes a typo for the peerDependency range in package.json, which prevents upgrade to Astro 4.0.
- #96
f1df277
Thanks @alexanderniebuhr! - Fixes an issue where this package could not be installed alongside Astro 4.0.
- #51
acf4c82
Thanks @alexanderniebuhr! - Updates dependencies
- #21
09d2504
Thanks @alexanderniebuhr! - Updates repository information
-
#8661
008f7647c
Thanks @Skn0tt! - fix build failures because of CJS builds and top-level await -
Updated dependencies [
69fbf95b2
]:- astro@3.1.4
- @astrojs/underscore-redirects@0.3.0
-
Updated dependencies [
c5633434f
,405ad9501
,6b1e79814
]:- astro@3.0.7
- @astrojs/underscore-redirects@0.3.0
-
#8188
d0679a666
Thanks @ematipico! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023. -
#8179
6011d52d3
Thanks @matthewp! - Astro 3.0 Release Candidate -
#8188
7511a4980
Thanks @ematipico! - When using an adapter that supports neither Squoosh or Sharp, Astro will now automatically use an image service that does not support processing, but still provides the other benefits ofastro:assets
such as enforcingalt
, no CLS etc to users -
#8188
148e61d24
Thanks @ematipico! - Reduced the amount of polyfills provided by Astro. Astro will no longer provide (no-op) polyfills for several web apis such as HTMLElement, Image or Document. If you need access to those APIs on the server, we recommend using more proper polyfills available on npm. -
#8029
2ee418e06
Thanks @matthewp! - Remove the Netlify Edge adapter@astrojs/netlify/functions
now supports Edge middleware, so a separate adapter for Edge itself (deploying your entire app to the edge) is no longer necessary. Please update your Astro config to reflect this change:// astro.config.mjs import { defineConfig } from 'astro/config'; - import netlify from '@astrojs/netlify/edge'; + import netlify from '@astrojs/netlify/functions'; export default defineConfig({ output: 'server', adapter: netlify({ + edgeMiddleware: true }), });
This adapter had several known limitations and compatibility issues that prevented many people from using it in production. To reduce maintenance costs and because we have a better story with Serveless + Edge Middleware, we are removing the Edge adapter.
-
#8188
cd2d7e769
Thanks @ematipico! - Introduced the concept of feature map. A feature map is a list of features that are built-in in Astro, and an Adapter can tell Astro if it can support it.import { AstroIntegration } from './astro'; function myIntegration(): AstroIntegration { return { name: 'astro-awesome-list', // new feature map supportedAstroFeatures: { hybridOutput: 'experimental', staticOutput: 'stable', serverOutput: 'stable', assets: { supportKind: 'stable', isSharpCompatible: false, isSquooshCompatible: false, }, }, }; }
-
#8188
80f1494cd
Thanks @ematipico! - Thebuild.split
andbuild.excludeMiddleware
configuration options are deprecated and have been replaced by options in the adapter config.If your config includes the
build.excludeMiddleware
option, replace it withedgeMiddleware
in your adapter options:import { defineConfig } from "astro/config"; import netlify from "@astrojs/netlify/functions"; export default defineConfig({ build: { - excludeMiddleware: true }, adapter: netlify({ + edgeMiddleware: true }), });
If your config includes the
build.split
option, replace it withfunctionPerRoute
in your adapter options:import { defineConfig } from "astro/config"; import netlify from "@astrojs/netlify/functions"; export default defineConfig({ build: { - split: true }, adapter: netlify({ + functionPerRoute: true }), });
- Updated dependencies [
d0679a666
,db39206cb
,adf9fccfd
,0c7b42dc6
,46c4c0e05
,364d861bd
,2484dc408
,81545197a
,6011d52d3
,c2c71d90c
,cd2d7e769
,80f1494cd
,e45f30293
,c0de7a7b0
,65c354969
,3c3100851
,34cb20021
,a824863ab
,44f7a2872
,1048aca55
,be6bbd2c8
,9e021a91c
,7511a4980
,c37632a20
,acf652fc1
,42785c7b7
,8450379db
,dbc97b121
,7d2f311d4
,2540feedb
,ea7ff5177
,68efd4a8b
,7bd1b86f8
,036388f66
,519a1c4e8
,1f58a7a1b
,2ae9d37f0
,a8f35777e
,70f34f5a3
,5208a3c8f
,84af8ed9d
,f003e7364
,ffc9e2d3d
,732111cdc
,0f637c71e
,33b8910cf
,8a5b0c1f3
,148e61d24
,e79e3779d
,632579dc2
,3674584e0
,1db4e92c1
,e7f872e91
,16f09dfff
,4477bb41c
,55c10d1d5
,3e834293d
,96beb883a
,997a0db8a
,80f1494cd
,0f0625504
,e1ae56e72
,f32d093a2
,f01eb585e
,b76c166bd
,a87cbe400
,866ed4098
,767eb6866
,32669cd47
]:- astro@3.0.0
- @astrojs/underscore-redirects@0.3.0
- Updated dependencies [
adf9fccfd
,582132328
,81545197a
,6011d52d3
,be6bbd2c8
,42785c7b7
,95120efbe
,2ae9d37f0
,f003e7364
,732111cdc
,33b8910cf
,e79e3779d
,179796405
,a87cbe400
,767eb6866
]:- astro@3.0.0-rc.5
- @astrojs/underscore-redirects@0.3.0-rc.1
-
#8029
2ee418e06
Thanks @matthewp! - Remove the Netlify Edge adapter@astrojs/netlify/functions
now supports Edge middleware, so a separate adapter for Edge itself (deploying your entire app to the edge) is no longer necessary. Please update your Astro config to reflect this change:// astro.config.mjs import { defineConfig } from 'astro/config'; - import netlify from '@astrojs/netlify/edge'; + import netlify from '@astrojs/netlify/functions'; export default defineConfig({ output: 'server', adapter: netlify({ + edgeMiddleware: true }), });
This adapter had several known limitations and compatibility issues that prevented many people from using it in production. To reduce maintenance costs and because we have a better story with Serveless + Edge Middleware, we are removing the Edge adapter.
- Updated dependencies [
65c354969
,3c3100851
,34cb20021
,7bd1b86f8
,519a1c4e8
,70f34f5a3
,0f637c71e
,866ed4098
,5b1e39ef6
]:- astro@3.0.0-beta.1
- @astrojs/underscore-redirects@0.3.0-beta.0
-
1eae2e3f7
Thanks @Princesseuh! - Remove support for Node 16. The lowest supported version by Astro and all integrations is now v18.14.1. As a reminder, Node 16 will be deprecated on the 11th September 2023. -
c022a4217
Thanks @Princesseuh! - When using an adapter that supports neither Squoosh or Sharp, Astro will now automatically use an image service that does not support processing, but still provides the other benefits ofastro:assets
such as enforcingalt
, no CLS etc to users -
3dc1ca2fa
Thanks @Princesseuh! - Reduced the amount of polyfills provided by Astro. Astro will no longer provide (no-op) polyfills for several web apis such as HTMLElement, Image or Document. If you need access to those APIs on the server, we recommend using more proper polyfills available on npm.
-
9b4f70a62
Thanks @ematipico! - Introduced the concept of feature map. A feature map is a list of features that are built-in in Astro, and an Adapter can tell Astro if it can support it.import { AstroIntegration } from './astro'; function myIntegration(): AstroIntegration { return { name: 'astro-awesome-list', // new feature map supportedAstroFeatures: { hybridOutput: 'experimental', staticOutput: 'stable', serverOutput: 'stable', assets: { supportKind: 'stable', isSharpCompatible: false, isSquooshCompatible: false, }, }, }; }
-
3fdf509b2
Thanks @ematipico! - Thebuild.split
andbuild.excludeMiddleware
configuration options are deprecated and have been replaced by options in the adapter config.If your config includes the
build.excludeMiddleware
option, replace it withedgeMiddleware
in your adapter options:import { defineConfig } from "astro/config"; import netlify from "@astrojs/netlify/functions"; export default defineConfig({ build: { - excludeMiddleware: true }, adapter: netlify({ + edgeMiddleware: true }), });
If your config includes the
build.split
option, replace it withfunctionPerRoute
in your adapter options:import { defineConfig } from "astro/config"; import netlify from "@astrojs/netlify/functions"; export default defineConfig({ build: { - split: true }, adapter: netlify({ + functionPerRoute: true }), });
- Updated dependencies [
1eae2e3f7
,76ddef19c
,9b4f70a62
,3fdf509b2
,2f951cd40
,c022a4217
,67becaa58
,bc37331d8
,dfc2d93e3
,3dc1ca2fa
,1be84dfee
,35f01df79
,3fdf509b2
,78de801f2
,59d6e569f
,7723c4cc9
,fb5cd6b56
,631b9c410
]:- astro@3.0.0-beta.0
- @astrojs/underscore-redirects@0.3.0-beta.0
-
#7975
f974c95a2
Thanks @lilnasy! - If you are using Netlify's On-demand Builders, you can now specify how long your pages should remain cached. By default, all pages will be rendered on first visit and reused on every subsequent visit until a redeploy. To set a custom revalidation time, call theruntime.setBuildersTtl()
local in either your frontmatter or middleware.--- import Layout from '../components/Layout.astro'; if (import.meta.env.PROD) { // revalidates every 45 seconds Astro.locals.runtime.setBuildersTtl(45); } --- <Layout title="Astro on Netlify"> {new Date(Date.now())} </Layout>
-
#7862
1859960d0
Thanks @Yan-Thomas! - Fix README GitHub search link -
#7754
298dbb89f
Thanks @natemoo-re! - Improve404
behavior forserverless
andedge
-
Updated dependencies [
298dbb89f
,9e2203847
,5c5da8d2f
,0b8375fe8
,89d015db6
,ebf7ebbf7
]:- astro@2.9.7
-
#7805
42a21b5da
Thanks @matthewp! - Prevent building .html file redirects in hybrid mode -
Updated dependencies [
31c4031ba
,5161cf919
,59b556232
,267487e63
,b063a2d8a
,d5f526b33
,7dbcbc86b
]:- astro@2.9.4
-
#7700
a77741d25
Thanks @delucis! - When a project uses the newbuild.excludeMiddleware
Astro config option, the@astrojs/netlify/functions
adapter will bundle your middleware to run in a Netlify Edge Function.See the Netlify adapter documentation for more details.
-
#7615
f21357b69
Thanks @ematipico! - 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.// astro.config.mjs import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify/functions'; export default defineConfig({ output: 'server', adapter: netlify(), build: { split: true, }, });
-
#7067
57f8d14c0
Thanks @matthewp! - Support for experimental redirectsThis adds support for the redirects RFC in the Netlify adapter, including a new
@astrojs/netlify/static
adapter for static sites.No changes are necessary when using SSR. Simply use configured redirects and the adapter will update your
_redirects
file.
-
#7260
39403c32f
Thanks @natemoo-re! - Unflags support foroutput: 'hybrid'
mode, which enables pre-rendering by default. The additionalexperimental.hybridOutput
flag can be safely removed from your configuration. -
Updated dependencies [
57f8d14c0
,414eb19d2
,a7e2b37ff
,dd1a6b6c9
,d72cfa7ca
,144813f73
,b5213654b
,e3b8c6296
,890a2bc98
,39403c32f
,101f03209
]:- astro@2.6.0
-
#6991
719002ca5
Thanks @MoustaphaDev! - Enable experimental support for hybrid SSR with pre-rendering enabled by defaultastro.config.mjs
import { defineConfig } from 'astro/config'; export defaultdefineConfig({ output: 'hybrid', experimental: { hybridOutput: true, }, })
Then add
export const prerender = false
to any page or endpoint you want to opt-out of pre-rendering.src/pages/contact.astro
--- export const prerender = false; if (Astro.request.method === 'POST') { // handle form submission } --- <form method="POST"> <input type="text" name="name" /> <input type="email" name="email" /> <button type="submit">Submit</button> </form>
-
#7104
826e02890
Thanks @bluwy! - Specify"files"
field to only publish necessary files -
Updated dependencies [
4516d7b22
,e186ecc5e
,c6d7ebefd
,914c439bc
,e9fc2c221
,075eee08f
,719002ca5
,fc52681ba
,fb84622af
,cada10a46
,cd410c5eb
,73ec6f6c1
,410428672
,763ff2d1e
,c1669c001
,3d525efc9
]:- astro@2.5.0
- #6793
1e3873c04
Thanks @andremralves! - fix: no edge functions deployed to netlify
-
#6651
416ceb973
Thanks @matthewp! - Use Deno API to set Astro.clientAddress in Netlify Edge -
Updated dependencies [
72fed684a
,45bff6fcc
,52d7a4a01
,9e88e0f23
,fa84f1a7d
,a98f6f418
,7f74326b7
]:- astro@2.2.1
- #6213
afbbc4d5b
Thanks @Princesseuh! - Updated compilation settings to disable downlevelling for Node 14
- Updated dependencies [
fec583909
,b087b83fe
,694918a56
,a20610609
,a4a74ab70
,75921b3cd
,afbbc4d5b
]:- astro@2.1.0
- @astrojs/webapi@2.1.0
-
#6323
5e26bc891
Thanks @Princesseuh! - Updated Undici to 5.20.0. This fixes a security issue and handling of cookies in certain cases in dev -
#6317
2eb73cb9d
Thanks @bluwy! - Use .mjs extension when building to support CJS environments -
Updated dependencies [
5e26bc891
,a156ecbb7
,ccd72e6bb
,504c7bacb
,63dda6ded
,f91a7f376
]:- astro@2.0.15
-
#6117
32abe49bd
Thanks @Princesseuh! - Fix polyfills not being available in certain cases -
Updated dependencies [
f6fc662c3
,592386b75
,1b591a143
,bf8d7366a
,ec38a8921
,f20a85b64
,9f22ac3d0
,cee70f5c6
,ac7fb04d6
,d1f5611fe
,2189170be
,32abe49bd
]:- astro@2.0.7
- #5874
1c230f103
Thanks @juanmiguelguerrero! - Addbuilders
config option for Netlify On-demand Builders.
- Updated dependencies [
b4432cd6b
,98a4a914b
,071e1dee7
,322e059d0
,b994f6f35
,12c68343c
]:- astro@2.0.3
-
#5584
9963c6e4d
& #5842c4b0cb8bf
Thanks @wulinsheng123 and @natemoo-re! - Breaking Change: client assets are built to an_astro
directory in the build output directory. Previously these were built to various locations, includingassets/
,chunks/
and the root of build output.You can control this location with the new
build
configuration option namedassets
. -
#5707
5eba34fcc
Thanks @bluwy! - Removeastro:build:start
backwards compatibility code -
#5806
7572f7402
Thanks @matthewp! - Make astro a peerDependency of integrationsThis marks
astro
as a peerDependency of several packages that are already gettingmajor
version bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with.
-
#5768
2f6745019
Thanks @Princesseuh! - Fix set-cookies not working in certain cases when using Node 18+ -
#5904
f5adbd6b5
Thanks @matthewp! - Support prerender in _redirects -
#5885
8f1ae06e5
Thanks @natemoo-re! - Fix issue with prerendered pages when usingedge-functions
adapter -
Updated dependencies [
93e633922
,16dc36a87
,01f3f463b
,e2019be6f
,05caf445d
,49ab4f231
,a342a486c
,8fb28648f
,1f92d64ea
,c2180746b
,ae8a012a7
,cf2de5422
,ce5c5dbd4
,ec09bb664
,665a2c222
,259a539d7
,f7aa1ec25
,4987d6f44
,304823811
,302e0ef8f
,55cea0a9d
,dd56c1941
,9963c6e4d
,46ecd5de3
,be901dc98
,f6cf92b48
,e818cc046
,8c100a6fe
,116d8835c
,840412128
,1f49cddf9
,7325df412
,16c7d0bfd
,c55fbcb8e
,a9c292026
,2a5786419
,4a1cabfe6
,a8d3e7924
,fa8c131f8
,64b8082e7
,c4b0cb8bf
,1f92d64ea
,23dc9ea96
,63a6ceb38
,a3a7fc929
,52209ca2a
,5fd9208d4
,5eba34fcc
,899214298
,3a00ecb3e
,5eba34fcc
,2303f9514
,1ca81c16b
,b66d7195c
]:- astro@2.0.0
- @astrojs/webapi@2.0.0
-
#5904
f5adbd6b5
Thanks @matthewp! - Support prerender in _redirects -
Updated dependencies [
4987d6f44
,304823811
,46ecd5de3
,7325df412
,a8d3e7924
,5fd9208d4
]:- astro@2.0.0-beta.4
- @astrojs/webapi@2.0.0-beta.1
-
#5885
8f1ae06e5
Thanks @natemoo-re! - Fix issue with prerendered pages when usingedge-functions
adapter -
Updated dependencies [
16dc36a87
,05caf445d
,a342a486c
,ce5c5dbd4
,be901dc98
,e818cc046
,8c100a6fe
,64b8082e7
,899214298
,3a00ecb3e
,1ca81c16b
,b66d7195c
]:- astro@2.0.0-beta.3
-
#5842
c4b0cb8bf
Thanks @natemoo-re! - Breaking Change: client assets are built to an_astro
directory in the build output directory. Previously these were built to various locations, includingassets/
,chunks/
and the root of build output.You can control this location with the new
build
configuration option namedassets
. -
#5806
7572f7402
Thanks @matthewp! - Make astro a peerDependency of integrationsThis marks
astro
as a peerDependency of several packages that are already gettingmajor
version bumps. This is so we can more properly track the dependency between them and what version of Astro they are being used with.
- Updated dependencies [
01f3f463b
,1f92d64ea
,c2180746b
,ae8a012a7
,cf2de5422
,ec09bb664
,665a2c222
,f7aa1ec25
,302e0ef8f
,840412128
,1f49cddf9
,c55fbcb8e
,4a1cabfe6
,c4b0cb8bf
,1f92d64ea
,23dc9ea96
,63a6ceb38
,52209ca2a
,2303f9514
]:- astro@2.0.0-beta.2
- @astrojs/webapi@2.0.0-beta.0
- #5768
2f6745019
Thanks @Princesseuh! - Fix set-cookies not working in certain cases when using Node 18+
-
#5297
d2960984c
Thanks @natemoo-re! - Introduces the experimental Prerender API.Note This API is not yet stable and is subject to possible breaking changes!
- Deploy an Astro server without sacrificing the speed or cacheability of static HTML.
- The Prerender API allows you to statically prerender specific
pages/
at build time.
Usage
- First, run
astro build --experimental-prerender
or enableexperimental: { prerender: true }
in yourastro.config.mjs
file. - Then, include
export const prerender = true
in any file in thepages/
directory that you wish to prerender.
-
#5056
e55af8a23
Thanks @matthewp! - # New build configurationThe ability to customize SSR build configuration more granularly is now available in Astro. You can now customize the output folder for
server
(the server code for SSR),client
(your client-side JavaScript and assets), andserverEntry
(the name of the entrypoint server module). Here are the defaults:import { defineConfig } from 'astro/config'; export default defineConfig({ output: 'server', build: { server: './dist/server/', client: './dist/client/', serverEntry: 'entry.mjs', }, });
These new configuration options are only supported in SSR mode and are ignored when building to SSG (a static site).
The integration hook
astro:build:start
includes a parambuildConfig
which includes all of these same options. You can continue to use this param in Astro 1.x, but it is deprecated in favor of the newbuild.config
options. All of the built-in adapters have been updated to the new format. If you have an integration that depends on this param we suggest upgrading to do this instead:export default function myIntegration() { return { name: 'my-integration', hooks: { 'astro:config:setup': ({ updateConfig }) => { updateConfig({ build: { server: '...', }, }); }, }, }; }
-
#4876
d3091f89e
Thanks @matthewp! - Adds the Astro.cookies APIAstro.cookies
is a new API for manipulating cookies in Astro components and API routes.In Astro components, the new
Astro.cookies
object is a map-like object that allows you to get, set, delete, and check for a cookie's existence (has
):--- type Prefs = { darkMode: boolean; }; Astro.cookies.set<Prefs>( 'prefs', { darkMode: true }, { expires: '1 month', } ); const prefs = Astro.cookies.get<Prefs>('prefs').json(); --- <body data-theme={prefs.darkMode ? 'dark' : 'light'}></body>
Once you've set a cookie with Astro.cookies it will automatically be included in the outgoing response.
This API is also available with the same functionality in API routes:
export function post({ cookies }) { cookies.set('loggedIn', false); return new Response(null, { status: 302, headers: { Location: '/login', }, }); }
See the RFC to learn more.
- #4842
812658ad2
Thanks @bluwy! - Add missing dependencies, support strict dependency installation (e.g. pnpm)
- #4722
4bc70f354
Thanks @bholmesdev! - Fix route validation failures on Netlify Edge
- #4558
742966456
Thanks @tony-sull! - Adding thewithastro
keyword to include the adapters on the Integrations Catalog
-
04ad44563
- > Astro v1.0 is out! Read the official announcement post.No breaking changes. This package is now officially stable and compatible with
astro@1.0.0
!
- Updated dependencies [
04ad44563
]:- @astrojs/webapi@1.0.0
-
#4015
6fd161d76
Thanks @matthewp! - Newoutput
configuration optionThis change introduces a new "output target" configuration option (
output
). Setting the output target lets you decide the format of your final build, either:"static"
(default): A static site. Your final build will be a collection of static assets (HTML, CSS, JS) that you can deploy to any static site host."server"
: A dynamic server application. Your final build will be an application that will run in a hosted server environment, generating HTML dynamically for different requests.
If
output
is omitted from your config, the default value"static"
will be used.When using the
"server"
output target, you must also include a runtime adapter via theadapter
configuration. An adapter will adapt your final build to run on the deployed platform of your choice (Netlify, Vercel, Node.js, Deno, etc).To migrate: No action is required for most users. If you currently define an
adapter
, you will need to also addoutput: 'server'
to your config file to make it explicit that you are building a server. Here is an example of what that change would look like for someone deploying to Netlify:import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify/functions'; export default defineConfig({ adapter: netlify(), + output: 'server', });
-
#3973
5a23483ef
Thanks @matthewp! - Adds support for Astro.clientAddressThe new
Astro.clientAddress
property allows you to get the IP address of the requested user.This property is only available when building for SSR, and only if the adapter you are using supports providing the IP address. If you attempt to access the property in a SSG app it will throw an error.
- #3854
b012ee55
Thanks @bholmesdev! - [astro add] Support adapters and third party packages
- #3734
4acd245d
Thanks @bholmesdev! - Fix: append shim to top of built file to avoid "can't read process of undefined" issues
- #3673
ba5ad785
Thanks @hippotastic! - Fix react dependencies to improve test reliability
- #3612
fca58cfd
Thanks @bholmesdev! - Fix: "vpath" import error when building for netlify edge
- #3592
0ddcef20
Thanks @tony-sull! - Adds support for base64 encoded responses in Netlify Functions
- #3503
207f58d1
Thanks @williamtetlow! - Aliasfrom 'astro'
imports to'@astro/types'
Update Deno and Netlify integrations to handle vite.resolves.alias as an array
- Updated dependencies [
4de53ecc
]:- @astrojs/webapi@0.12.0
- #3381
43d92227
Thanks @sarahetter! - Updating out directories for Netlify Functions
- #3377
e1294c42
Thanks @sarahetter! - Change out directories on dist and serverEntry
- #3342
352fc316
Thanks @thepassle! - create redirects file for netlify edge adapter
- #3150
05cf1a50
Thanks @matthewp! - Outputs manifest.json in correct folder for Netlify Edge Functions
- #3079
9f248b05
Thanks @hippotastic! - Make Netlify adapter actually append redirects
815d62f1
Thanks @FredKSchott! - no changes.
-
732ea388
Thanks @FredKSchott! - Improve the Netlify adapter:- Remove
site
config requirement - Fix an issue where query params were being stripped
- Pass the event body to the request object
- Remove
- #2996
77aa3a5c
Thanks @bholmesdev! - Add human-readable error when a site is not provided in your astro.config
- #2996
77aa3a5c
Thanks @bholmesdev! - Add human-readable error when a site is not provided in your astro.config
e425f896
Thanks @FredKSchott! - Update config options to respect RFC0019