From 589bd4e1da7c30fe5c5d7b15a18e205f7fa1163f Mon Sep 17 00:00:00 2001 From: Xiang Date: Tue, 14 Apr 2026 20:31:34 +0800 Subject: [PATCH 1/2] docs: Azure Static Web App deployment steps Added Azure Static Web App deployment instructions --- docs/start/framework/react/guide/hosting.md | 41 +++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/docs/start/framework/react/guide/hosting.md b/docs/start/framework/react/guide/hosting.md index 26e2e0db663..04bc809e350 100644 --- a/docs/start/framework/react/guide/hosting.md +++ b/docs/start/framework/react/guide/hosting.md @@ -285,6 +285,47 @@ You can start your application by running: npm run start ``` +### Azure Static Web App + +Azure SWA uses [`Nitro`](#nitro) for deployment, but the Nitro preset `azure-swa` needs to be extended for it to work proporly. + +After installing Nitro: + +1. Copy this custom nitro preset [`azure-swa-custom`](https://github.com/Xiang-CH/tanstack-azure-swa-template/tree/main/nitro) (the entire directory) in to your project root. + +2. Update you `vite.config.ts` with the following Nitro configuration: + ```ts + // vite.config.ts + const config = defineConfig({ + plugins: [ + nitro({ + preset: './nitro/presets/azure-swa-custom.mjs', //original template: 'azure-swa' + azure: { + config: { + routes: [ + { + route: '/_serverFn/*', + rewrite: '/api/server', + }, + ], + }, + }, + }), + // other plugins + ], + }); + ``` + +3. Deploy to [Azure SWA](https://portal.azure.com/#create/Microsoft.StaticApp) with the following build configuration: + - App location: `/` + - API location: `.output/server` + - Output location: `.output/public` + +4. If you App location is not the project root the build config should be the following: + - App location: `/` + - API location: `//.output/server` + - Output location: `.output/public` + ### Bun > [!IMPORTANT] From 3921b9c2e2ae9e93ae1d67a66e5f0e8414fe717c Mon Sep 17 00:00:00 2001 From: Xiang Date: Tue, 14 Apr 2026 12:40:52 +0000 Subject: [PATCH 2/2] docs: fix typo --- docs/start/framework/react/guide/hosting.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/start/framework/react/guide/hosting.md b/docs/start/framework/react/guide/hosting.md index 04bc809e350..330f7e5d1ec 100644 --- a/docs/start/framework/react/guide/hosting.md +++ b/docs/start/framework/react/guide/hosting.md @@ -287,13 +287,13 @@ npm run start ### Azure Static Web App -Azure SWA uses [`Nitro`](#nitro) for deployment, but the Nitro preset `azure-swa` needs to be extended for it to work proporly. +Azure SWA uses [`Nitro`](#nitro) for deployment, but the Nitro preset `azure-swa` needs to be extended for it to work properly. After installing Nitro: 1. Copy this custom nitro preset [`azure-swa-custom`](https://github.com/Xiang-CH/tanstack-azure-swa-template/tree/main/nitro) (the entire directory) in to your project root. -2. Update you `vite.config.ts` with the following Nitro configuration: +2. Update your `vite.config.ts` with the following Nitro configuration: ```ts // vite.config.ts const config = defineConfig({ @@ -321,7 +321,7 @@ After installing Nitro: - API location: `.output/server` - Output location: `.output/public` -4. If you App location is not the project root the build config should be the following: +4. If your App location is not the project root the build config should be the following: - App location: `/` - API location: `//.output/server` - Output location: `.output/public`