Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import path from "path";
import { fileURLToPath } from "url";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const basePath = process.env.VITE_BASE_PATH ?? '/';

export default defineConfig({
plugins: [
Expand Down Expand Up @@ -40,14 +41,29 @@ export default defineConfig({
purpose: "any",
},
],
shortcuts: [
{
name: "Quick Note",
short_name: "Quick Note",
description: "Log a quick workout note with RPE and feel",
url: `${basePath}?quick=1`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 URL may be malformed when VITE_BASE_PATH lacks a trailing slash

If VITE_BASE_PATH is set to a sub-path without a trailing slash (e.g. /pedalnotes), the template literal produces /pedalnotes?quick=1 — the query string is appended directly to the base path rather than to the root index (/pedalnotes/?quick=1). Vite expects base to end with /, but it is worth making this construction resilient so the shortcut URL always targets the app's index page.

Suggested change
url: `${basePath}?quick=1`,
url: `${basePath.replace(/\/?$/, '/')}?quick=1`,

icons: [
{
src: "pwa-192x192.png",
sizes: "192x192",
type: "image/png",
},
],
},
],
},
workbox: {
globPatterns: ["**/*.{js,css,html,ico,png,svg,woff2}"],
runtimeCaching: [],
},
}),
],
base: process.env.VITE_BASE_PATH ?? '/',
base: basePath,
resolve: {
alias: {
"@": path.resolve(__dirname, "client", "src"),
Expand Down
Loading