Releases: geoffrich/svelte-adapter-azure-swa
svelte-adapter-azure-swa v0.21.0
This release migrates the sk_render
Azure function used for server-side request handling to v4 of the Node.js programming model. This should be a non-breaking change for most users, but some configuration options require changes.
Breaking changes
The server-side request handling Azure function's path has changed from /api/__render
to /api/sk_render
, since v4 does not allow routes starting with underscores. If you have any configuration relying on that path (unlikely), you will need to make updates to use the new path.
If you are setting the apiDir
option and deploying other Azure functions with your Static Web App, this is a breaking change and you need to make the following updates:
- Any other Azure functions you deploy with your Static Web App need to be migrated to the v4 programming model
- The main field in your package.json needs to use a glob pattern that includes both the sk_render/index.js entrypoint as well as the entrypoints for your other Azure functions.
- The SvelteKit Azure function now uses the prefix
sk_render
, so you can't have another Azure function using that prefix - If you are using a CUSTOM_BUILD_COMMAND, make sure to install dependencies inside the
build/server
folder
Features
Special thanks to @derkoe and @ktarmyshov for their PRs for this feature!
svelte-adapter-azure-swa v0.20.1
svelte-adapter-azure-swa v0.20.0
This version includes breaking changes in required dependencies:
- Require SvelteKit version 2. See the SvelteKit v2 migration guide first to handle any SvelteKit breaking changes.
- Require Node 18 or higher. If you previously set
platform.apiRuntime
tonode:18
in the customStaticWebAppConfig, you can remove this setting. - Use esbuild 0.19.9 to build the deployed Azure function for SSR
IMPORTANT: since Azure's build system still defaults to Node 16 to build your app, you may need to set the engines field in your package.json to force it to build with Node 18. Node 16 is EOL and is not supported by SvelteKit v2.
Features
- require SvelteKit 2 and Node 18 (c77c842)
svelte-adapter-azure-swa v0.19.1
svelte-adapter-azure-swa v0.19.0
svelte-adapter-azure-swa v0.18.0
svelte-adapter-azure-swa v0.17.0
This release contains two (likely non-breaking) features.
Allow customizing the node version
In production, your SvelteKit app will run a Node Azure Function to handle server requests. By default, this Azure Function uses Node 16. If you want to customize your Node version (version 18 is in public preview for Azure SWA), you can do so with the customStaticWebAppConfig
adapter option to set platform.apiRuntime
.
// svelte.config.js
import adapter from 'svelte-adapter-azure-swa';
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter({
customStaticWebAppConfig: {
platform: {
apiRuntime: 'node:18'
}
}
})
}
};
export default config;
Throw an error during build if the app declares /api routes
In production, Azure SWA will handle any request to routes starting with /api
. If you also declare SvelteKit routes starting with /api
, they will not be reachable in production and hitting them returns confusing errors (see #89 and #78 for context).
Because this, the adapter will now throw an error at build time and instruct you to rename the routes. If you do want to allow these routes for some reason, you can set allowReservedSwaRoutes
in your adapter options. However, this will not start routing /api
requests to your SvelteKit app, since SWA does not allow configuring the /api
route.