* wip * Deprecate buildConfig and move to config.build * Implement the standalone server * Stay backwards compat * Add changesets * correctly merge URLs * Get config earlier * update node tests * Return the preview server * update remaining tests * swap usage and config ordering * Update packages/astro/src/@types/astro.ts Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/metal-pumas-walk.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/metal-pumas-walk.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/stupid-points-refuse.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/stupid-points-refuse.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Link to build.server config Co-authored-by: Fred K. Schott <fkschott@gmail.com> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
1.5 KiB
astro | @astrojs/cloudflare | @astrojs/deno | @astrojs/image | @astrojs/netlify | @astrojs/node | @astrojs/vercel |
---|---|---|---|---|---|---|
minor | minor | minor | minor | minor | minor | minor |
New build configuration
The 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), and serverEntry
(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).
Integration hook change
The integration hook astro:build:start
includes a param buildConfig
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 new build.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: '...'
}
});
}
}
}
}