Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion starters/features/csr/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Qwik browser-only starter</title>
<title>Qwik SPA starter</title>
Copy link
Member

Choose a reason for hiding this comment

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

Hmmm - SPA implies multiple routes, no? Without qwik-router there's no routes...
Technically, it's the CSR starter.


<script async type="module" src="@qwik.dev/core/qwikloader.js">
// ^ This is the QwikLoader, it's required for Qwik to work
Expand Down
12 changes: 6 additions & 6 deletions starters/features/csr/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"description": "Use Qwik in browser-only mode",
"description": "Use Qwik in SPA mode (client side rendering)",
"__qwik__": {
"displayName": "Integration: Qwik in browser-only mode",
"displayName": "Integration: Qwik in SPA mode (client side rendering)",
"priority": -10,
"viteConfig": {},
"docs": [
Expand All @@ -16,14 +16,14 @@
]
}
},
"dependencies": {
"@qwik.dev/core": "workspace:*"
},
"devDependencies": {
"serve": "latest",
"vite-plugin-static-copy": "latest",
"vite": "latest"
},
"scripts": {
"dev": "vite",
"build": "vite build"
"build": "vite build",
"preview": "vite build && serve dist"
}
}
17 changes: 15 additions & 2 deletions starters/features/csr/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@
import { qwikVite } from "@qwik.dev/core/optimizer";
import { defineConfig, type UserConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import { viteStaticCopy } from "vite-plugin-static-copy";

export default defineConfig((): UserConfig => {
export default defineConfig((config): UserConfig => {
return {
plugins: [qwikVite({ csr: true }), tsconfigPaths({ root: "." })],
plugins: [
qwikVite({ csr: true }),
tsconfigPaths({ root: "." }),
config.mode === "development" &&
viteStaticCopy({
Copy link
Member Author

Choose a reason for hiding this comment

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

This is needed to resolve
<script async type="module" src="@qwik.dev/core/qwikloader.js"> in dev mode.

Copy link
Contributor

Choose a reason for hiding this comment

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

why is it needed in dev mode?

Copy link
Member Author

Choose a reason for hiding this comment

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

without this fix, in dev mode, is not resolving and serving the file correctly.

Copy link
Contributor

Choose a reason for hiding this comment

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

What about using the qwikloader: "inline" prop we just brought back in v1.17.0?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm that seems wrong, vite should be parsing the index.html and resolving the qwikloader.js into a module.
Isn't it working? I thought I tested it.

targets: [
{
src: "./node_modules/@qwik.dev/core/dist/qwikloader.js",
dest: "@qwik.dev/core",
},
],
}),
],
};
});