diff --git a/scripts/prebuild.cjs b/scripts/prebuild.cjs index 0715894..87081e9 100644 --- a/scripts/prebuild.cjs +++ b/scripts/prebuild.cjs @@ -23,7 +23,13 @@ publicPackageJson.homepage = packageJson.homepage if (packageJson.homepage) { // github action outputs. Do not touch. console.log('::set-output name=public_url::' + packageJson.homepage) - console.log('::set-output name=public_path::' + new URL(packageJson.homepage).pathname) + let pathname = "" + try { + pathname = new URL(packageJson.homepage).pathname + } catch { + pathname = packageJson.homepage + } + console.log('::set-output name=public_path::' + pathname) } // log stuff @@ -57,6 +63,11 @@ function getPublicUrls() { VITE_BASE_URL: cdnUrl } } + if (isVercel) { + return { + VITE_BASE_URL: "/" + } + } // localhost console.log('Using empty pubic url') return { diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..df40d62 --- /dev/null +++ b/vercel.json @@ -0,0 +1,20 @@ +{ + "version": 2, + "name": "auth", + "build": { + "env": { + "GEN_STATIC_LOCAL": "true", + "VITE_REACT_APP_DCL_DEFAULT_ENV": "dev" + } + }, + "github": { + "silent": true + }, + "redirects": [ + { + "source": "/", + "destination": "/auth" + } + ], + "rewrites": [{ "source": "/(.*)", "destination": "/" }] +}