Skip to content

Commit 98e6a8f

Browse files
committed
qwik: fix build so it works from its path
1 parent 4e8265f commit 98e6a8f

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
lines changed

frameworks/keyed/qwik/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Qwik
2+
3+
Please note that this benchmark does not test the true power of Qwik, namely resumability. So the expected result is that Qwik is average in this benchmark, but it is much faster in real world applications than other frameworks.
4+
5+
See https://qwik.builder.io/docs/concepts/think-qwik/
6+
7+
## Build
8+
9+
The build uses the SSG capabilities of Qwik to create the static files.
10+
11+
Note: `npm build-prod` involves moving the built files to the root of the dist dir, because Vite outputs the full directory structure that is expected, and we need to "deploy" this so the benchmark can load the files.
12+
13+
That is to say, while `/dist` is the serving location for the benchmark, the files are actually built in `/dist/frameworks/keyed/qwik/dist`.

frameworks/keyed/qwik/adapters/static/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export default extendConfig(baseConfig, () => {
1212
},
1313
plugins: [
1414
staticAdapter({
15-
origin: "https://yoursite.qwik.dev",
15+
origin:
16+
"https://github.com/krausest/js-framework-benchmark/tree/master/frameworks/qwik",
1617
}),
1718
],
1819
};

frameworks/keyed/qwik/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"scripts": {
1515
"build-dev": "vite --mode ssr",
16-
"build-prod": "qwik build",
16+
"build-prod": "rm -rf dist; qwik build && mv dist/frameworks/keyed/qwik/dist/* dist/ && rm -rf dist/frameworks",
1717
"build": "qwik build",
1818
"build.client": "vite build",
1919
"build.preview": "vite build --ssr src/entry.preview.tsx",

frameworks/keyed/qwik/src/components/router-head/router-head.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
import { component$ } from "@builder.io/qwik";
2-
import { useDocumentHead, useLocation } from "@builder.io/qwik-city";
2+
import { useDocumentHead } from "@builder.io/qwik-city";
33

44
/**
55
* The RouterHead component is placed inside of the document `<head>` element.
66
*/
77
export const RouterHead = component$(() => {
88
const head = useDocumentHead();
9-
const loc = useLocation();
109

1110
return (
1211
<>
1312
<title>{head.title}</title>
1413

15-
<link rel="canonical" href={loc.url.href} />
1614
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
17-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
1815

1916
{/* Served by the benchmark */}
2017
<link rel="stylesheet" href="/css/currentStyle.css" />

frameworks/keyed/qwik/src/entry.ssr.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export default function (opts: RenderToStreamOptions) {
2424
// Use container attributes to set attributes on the html tag.
2525
containerAttributes: {
2626
lang: "en-us",
27-
base: "/frameworks/keyed/qwik/dist",
2827
...opts.containerAttributes,
2928
},
3029
});

frameworks/keyed/qwik/src/root.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export default component$(() => {
1818
<QwikCityProvider>
1919
<head>
2020
<meta charSet="utf-8" />
21-
<link rel="manifest" href="/manifest.json" />
2221
<RouterHead />
2322
</head>
2423
<body lang="en">

frameworks/keyed/qwik/vite.config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@ import tsconfigPaths from "vite-tsconfig-paths";
55

66
export default defineConfig(() => {
77
return {
8+
// This tells vite where the build is deployed
9+
base: "/frameworks/keyed/qwik/dist/",
810
plugins: [qwikCity(), qwikVite(), tsconfigPaths()],
911
preview: {
1012
headers: {
1113
"Cache-Control": "public, max-age=600",
1214
},
1315
},
14-
resolve: {
15-
alias: {
16-
// The benchmark CSS
17-
"/css": "../../../css",
18-
},
19-
},
2016
server: {
2117
fs: {
2218
allow: ["../../.."],

0 commit comments

Comments
 (0)