feat: support path-based deployment for standalone apps
Add VITE_BASE_PATH support to standalone app configs so they can be served under a path prefix (e.g., app.domain.com/sortir/) instead of a separate subdomain. This enables shared auth via same-origin localStorage. - Vite configs: configurable base path via VITE_BASE_PATH env var - Routers: use import.meta.env.BASE_URL for history base - PWA manifests: use base path for start_url and scope - Default: / (backward compatible with subdomain mode) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
cf08b76515
commit
1edea25862
4 changed files with 15 additions and 6 deletions
|
|
@ -54,7 +54,7 @@ export async function createAppInstance() {
|
|||
].filter(Boolean)
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
// Record page is the home page in standalone mode
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export async function createAppInstance() {
|
|||
].filter(Boolean)
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
// Activities page is the home page in standalone mode
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,9 +33,13 @@ function activitiesHtmlPlugin(): Plugin {
|
|||
|
||||
/**
|
||||
* Vite config for the standalone Sortir activities app.
|
||||
* Deployed to sortir.ariege.io
|
||||
*
|
||||
* Set VITE_BASE_PATH to deploy under a path prefix:
|
||||
* VITE_BASE_PATH=/sortir/ → app.ariege.io/sortir/ (shared auth)
|
||||
* (default: /) → sortir.ariege.io (standalone subdomain)
|
||||
*/
|
||||
export default defineConfig(({ mode }) => ({
|
||||
base: process.env.VITE_BASE_PATH || '/',
|
||||
plugins: [
|
||||
activitiesHtmlPlugin(),
|
||||
vue(),
|
||||
|
|
@ -65,8 +69,8 @@ export default defineConfig(({ mode }) => ({
|
|||
background_color: '#ffffff',
|
||||
display: 'standalone',
|
||||
orientation: 'portrait-primary',
|
||||
start_url: '/',
|
||||
scope: '/',
|
||||
start_url: process.env.VITE_BASE_PATH || '/',
|
||||
scope: process.env.VITE_BASE_PATH || '/',
|
||||
id: 'sortir-activities',
|
||||
categories: ['social', 'entertainment', 'lifestyle'],
|
||||
lang: 'fr',
|
||||
|
|
|
|||
|
|
@ -33,8 +33,13 @@ function castleHtmlPlugin(): Plugin {
|
|||
|
||||
/**
|
||||
* Vite config for the standalone Castle accounting app.
|
||||
*
|
||||
* Set VITE_BASE_PATH to deploy under a path prefix:
|
||||
* VITE_BASE_PATH=/castle/ → app.ariege.io/castle/ (shared auth)
|
||||
* (default: /) → castle.ariege.io (standalone subdomain)
|
||||
*/
|
||||
export default defineConfig(({ mode }) => ({
|
||||
base: process.env.VITE_BASE_PATH || '/',
|
||||
plugins: [
|
||||
castleHtmlPlugin(),
|
||||
vue(),
|
||||
|
|
@ -64,7 +69,7 @@ export default defineConfig(({ mode }) => ({
|
|||
background_color: '#ffffff',
|
||||
display: 'standalone',
|
||||
orientation: 'portrait-primary',
|
||||
start_url: '/',
|
||||
start_url: process.env.VITE_BASE_PATH || '/',
|
||||
scope: '/',
|
||||
id: 'castle-accounting',
|
||||
categories: ['finance', 'business', 'productivity'],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue