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, }, });