Skip to content

Commit

Permalink
b381b22 fix(qwik-city): enforce / on base paths (#6301)
Browse files Browse the repository at this point in the history
  • Loading branch information
wmertens committed May 15, 2024
1 parent a9015e6 commit f993f39
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
15 changes: 13 additions & 2 deletions vite/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
}
Expand Down
15 changes: 13 additions & 2 deletions vite/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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;
}
Expand Down

0 comments on commit f993f39

Please sign in to comment.