I've tried to use the documentation here and here in order to generate static files and put them into the docs folder, but for some reason, the site looks broken. The splitted JS files don't work as they should when using the auto-generated GitHub URL https://github.com/<UserID>/<RepoName>
. So, I ended up using a subdomain of my own and having the errors which are posted at the of this post.
My vite.config.ts
import { qwikCity } from "@builder.io/qwik-city/vite";
import { qwikVite } from "@builder.io/qwik/optimizer";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig(() => {
return {
ssr: { target: "node", format: "cjs" },
plugins: [
qwikCity(),
qwikVite({
client: {
outDir: "docs/",
},
}),
tsconfigPaths(),
],
};
});
My entry.static.tsx
import { qwikCityGenerate } from '@builder.io/qwik-city/static/node';
import { join } from 'path';
import { fileURLToPath } from 'url';
import render from './entry.ssr';
// Execute Qwik City Static Site Generator
qwikCityGenerate(render, {
origin: 'https://qwik.builder.io/',
outDir: join(fileURLToPath(import.meta.url), '..', '..', 'docs'),
});
And my package.json
"name": "my-qwik-basic-starter",
"description": "Recommended for your first Qwik app (comes with Qwik City)",
"engines": {
"node": ">=15.0.0"
},
"private": true,
"scripts": {
"build": "qwik build",
"build.client": "vite build",
"build.full": "npm run build && npm run build.static && node server/entry.static.js",
"build.preview": "vite build --ssr src/entry.preview.tsx",
"build.static": "vite build --ssr src/entry.static.tsx",
"build.types": "tsc --incremental --noEmit",
"dev": "vite --mode ssr",
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
"fmt": "prettier --write .",
"fmt.check": "prettier --check .",
"lint": "eslint \"src/**/*.ts*\"",
"preview": "qwik build preview && vite preview --open",
"ssg": "node server/entry.static",
"start": "vite --open --mode ssr",
"qwik": "qwik"
},
"devDependencies": {
"@builder.io/qwik": "0.10.0",
"@builder.io/qwik-city": "0.0.112",
"@types/eslint": "8.4.6",
"@types/node": "latest",
"@typescript-eslint/eslint-plugin": "5.40.0",
"@typescript-eslint/parser": "5.40.0",
"eslint": "8.25.0",
"eslint-plugin-qwik": "0.10.0",
"node-fetch": "3.2.10",
"prettier": "2.7.1",
"sass": "^1.55.0",
"typescript": "4.8.4",
"vite": "3.1.7",
"vite-tsconfig-paths": "3.5.1"
},
"dependencies": {
"firebase": "^9.12.0",
"minimasonry": "^1.3.0"
}
}
Trying to run npm run build.full
Getting those errors in the console
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '_qc_')
at ee (q-9c2a9820.js:2:28350)
at S (q-9c2a9820.js:2:28367)
at q-9c2a9820.js:2:27830
at Or (q-9c2a9820.js:2:28337)
at Us (q-9c2a9820.js:2:17115)
at Vs (q-9c2a9820.js:2:17549)
at c ((index):8:2636)
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Dt')
at Vs (q-9c2a9820.js:2:17567)
at c ((index):8:2636)
Not sure what I am missing here.
Thanks!