fix(pwa): set start_url/scope from VITE_BASE_URL so install launches /kiwi/ not site root
This commit is contained in:
parent
7e0722cc23
commit
b86b7732dc
1 changed files with 8 additions and 2 deletions
|
|
@ -3,6 +3,12 @@ import vue from '@vitejs/plugin-vue'
|
||||||
import { VitePWA } from 'vite-plugin-pwa'
|
import { VitePWA } from 'vite-plugin-pwa'
|
||||||
import { fileURLToPath, URL } from 'node:url'
|
import { fileURLToPath, URL } from 'node:url'
|
||||||
|
|
||||||
|
// Ensure start_url/scope match the deployment base path so the PWA launches
|
||||||
|
// at the correct URL (e.g. /kiwi/ in cloud, / in local dev) rather than the
|
||||||
|
// site root (which on menagerie.circuitforge.tech is the account page).
|
||||||
|
const rawBase = process.env.VITE_BASE_URL ?? '/'
|
||||||
|
const appBase = rawBase.endsWith('/') ? rawBase : rawBase + '/'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
|
|
@ -21,8 +27,8 @@ export default defineConfig({
|
||||||
background_color: '#1e1c1a',
|
background_color: '#1e1c1a',
|
||||||
display: 'standalone',
|
display: 'standalone',
|
||||||
orientation: 'portrait',
|
orientation: 'portrait',
|
||||||
scope: '/',
|
scope: appBase,
|
||||||
start_url: '/',
|
start_url: appBase,
|
||||||
icons: [
|
icons: [
|
||||||
{
|
{
|
||||||
src: '/icons/icon-192.png',
|
src: '/icons/icon-192.png',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue