From f993f3993ad7168a8c76fe0eb57c2a7e3d14e1f2 Mon Sep 17 00:00:00 2001 From: Wout Mertens Date: Wed, 15 May 2024 20:38:50 +0000 Subject: [PATCH] b381b22 fix(qwik-city): enforce / on base paths (#6301) https://github.com/QwikDev/qwik/commit/ae5f524c13cf3a5c379330ec69f0edfb4ec74eb3 --- package.json | 2 +- vite/index.cjs | 15 +++++++++++++-- vite/index.mjs | 15 +++++++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7326125..1082496 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@builder.io/qwik-city", "description": "The meta-framework for Qwik.", - "version": "1.5.4-dev20240514003602", + "version": "1.5.4-dev20240515202920", "bugs": "https://github.com/QwikDev/qwik/issues", "dependencies": { "@mdx-js/mdx": "^3.0.1", diff --git a/vite/index.cjs b/vite/index.cjs index f7d7419..ee57f95 100644 --- a/vite/index.cjs +++ b/vite/index.cjs @@ -21881,6 +21881,14 @@ function resetBuildContext(ctx) { } } function normalizeOptions(rootDir, viteBasePath, userOpts) { + if (!(viteBasePath.startsWith("/") && viteBasePath.endsWith("/"))) { + console.error( + `warning: vite's config.base must begin and end with /. This will be an error in v2. If you have a valid use case, please open an issue.` + ); + if (!viteBasePath.endsWith("/")) { + viteBasePath += "/"; + } + } const opts = { ...userOpts }; if (typeof opts.routesDir !== "string") { opts.routesDir = (0, import_node_path3.resolve)(rootDir, "src", "routes"); @@ -21900,11 +21908,14 @@ function normalizeOptions(rootDir, viteBasePath, userOpts) { if (typeof opts.basePathname !== "string") { opts.basePathname = viteBasePath; } - const url = new URL(opts.basePathname, "https://qwik.builer.io/"); - opts.basePathname = url.pathname; if (!opts.basePathname.endsWith("/")) { + console.error( + `Warning: qwik-city plugin basePathname must end with /. This will be an error in v2` + ); opts.basePathname += "/"; } + const url = new URL(opts.basePathname, "https://qwik.dev/"); + opts.basePathname = url.pathname; if (typeof opts.trailingSlash !== "boolean") { opts.trailingSlash = true; } diff --git a/vite/index.mjs b/vite/index.mjs index 33aab5d..837e7d2 100644 --- a/vite/index.mjs +++ b/vite/index.mjs @@ -21871,6 +21871,14 @@ function resetBuildContext(ctx) { } } function normalizeOptions(rootDir, viteBasePath, userOpts) { + if (!(viteBasePath.startsWith("/") && viteBasePath.endsWith("/"))) { + console.error( + `warning: vite's config.base must begin and end with /. This will be an error in v2. If you have a valid use case, please open an issue.` + ); + if (!viteBasePath.endsWith("/")) { + viteBasePath += "/"; + } + } const opts = { ...userOpts }; if (typeof opts.routesDir !== "string") { opts.routesDir = resolve(rootDir, "src", "routes"); @@ -21890,11 +21898,14 @@ function normalizeOptions(rootDir, viteBasePath, userOpts) { if (typeof opts.basePathname !== "string") { opts.basePathname = viteBasePath; } - const url = new URL(opts.basePathname, "https://qwik.builer.io/"); - opts.basePathname = url.pathname; if (!opts.basePathname.endsWith("/")) { + console.error( + `Warning: qwik-city plugin basePathname must end with /. This will be an error in v2` + ); opts.basePathname += "/"; } + const url = new URL(opts.basePathname, "https://qwik.dev/"); + opts.basePathname = url.pathname; if (typeof opts.trailingSlash !== "boolean") { opts.trailingSlash = true; }