From 6df40c15311f1a40082a3e5500c439fe86bcbdd5 Mon Sep 17 00:00:00 2001 From: vahid-ahmadi Date: Wed, 12 Aug 2026 11:06:58 +0100 Subject: [PATCH] Deploy the article on Vercel at its public path app-v2 serves this article by proxying /uk/introducing-policyengine-uk-chat and everything beneath it to a deployment, path for path. Building at that same path means an asset URL resolves identically whether the reader arrives via policyengine.org or the deployment directly, which is how /uk/chat and the WATCA calculator are already wired. Without this the proxy breaks on assets: a build at the domain root emits /assets/... , which under policyengine.org falls outside the zone route. vercel.json pins the build command and output directory, and redirects the deployment root to the article so the bare domain is not a 404. Co-Authored-By: Claude Opus 5 (1M context) --- vercel.json | 7 +++++++ vite.config.js | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 vercel.json diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..2b9830a --- /dev/null +++ b/vercel.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://openapi.vercel.sh/vercel.json", + "buildCommand": "bun run build", + "outputDirectory": "dist", + "cleanUrls": true, + "redirects": [{ "source": "/", "destination": "/uk/introducing-policyengine-uk-chat", "permanent": false }] +} diff --git a/vite.config.js b/vite.config.js index 5ceed08..ce30183 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,13 +1,22 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; +// The article is proxied by policyengine-app-v2's zone routes, which forward +// /uk/introducing-policyengine-uk-chat and everything beneath it to this +// deployment path-for-path. Serving the build at that same path on our own +// Vercel domain means an asset URL resolves identically whether the reader +// arrived via policyengine.org or the deployment directly — the pattern +// /uk/chat and the WATCA calculator already use. +const ARTICLE_PATH = '/uk/introducing-policyengine-uk-chat'; + export default defineConfig({ - base: './', + base: `${ARTICLE_PATH}/`, plugins: [react()], optimizeDeps: { entries: ['index.html'], }, build: { - outDir: 'dist', + outDir: `dist${ARTICLE_PATH}`, + emptyOutDir: true, }, });