Skip to content

feat: refactor build configuration #7748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 21, 2025
Merged
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
5 changes: 5 additions & 0 deletions .changeset/all-cloths-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@qwik.dev/core': minor
---

FEAT: the QRL segment mapping during Vite dev mode now happens in core and does not require providing a separate `symbolMapper` function any more.
5 changes: 5 additions & 0 deletions .changeset/green-drinks-strive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@qwik.dev/router': minor
---

FEAT: qwikRouter middleware no longer needs qwikRouterConfig, it handles it internally
5 changes: 5 additions & 0 deletions .changeset/large-houses-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@qwik.dev/core': patch
---

FIX: the `srcInput` option to `qwikVite` is deprecated because it's unused.
6 changes: 6 additions & 0 deletions .changeset/many-tips-win.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@qwik.dev/core': minor
'@qwik.dev/router': patch
---

FEAT: Server output chunk files are now under their own build/ subdir, like the client build. This makes it easier to override the chunk filenames. This is possible because the Router metadata files are now an earlier part of the build process.
5 changes: 5 additions & 0 deletions .changeset/short-suits-bet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@qwik.dev/core': minor
---

FIX: `qwikVite` has better vite config handling around input files, and no longer writes the q-manifest file to a temp dir.
2 changes: 1 addition & 1 deletion e2e/adapters-e2e/adapters/express/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default extendConfig(baseConfig, () => {
build: {
ssr: true,
rollupOptions: {
input: ['src/entry.express.tsx', '@qwik-router-config'],
input: ['src/entry.express.tsx'],
},
},
plugins: [nodeServerAdapter({ name: 'express' })],
Expand Down
2 changes: 0 additions & 2 deletions e2e/adapters-e2e/src/entry.express.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
import { createQwikRouter } from '@qwik.dev/router/middleware/node';
import 'dotenv/config';
import qwikRouterConfig from '@qwik-router-config';
import render from './entry.ssr';
import express from 'express';
import { fileURLToPath } from 'node:url';
Expand All @@ -25,7 +24,6 @@ const PORT = process.env.PORT ?? 3000;
// Create the Qwik City Node middleware
const { router, notFound } = createQwikRouter({
render,
qwikRouterConfig,
// getOrigin(req) {
// // If deploying under a proxy, you may need to build the origin from the request headers
// // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto
Expand Down
3 changes: 1 addition & 2 deletions e2e/adapters-e2e/src/entry.preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
*
*/
import { createQwikRouter } from '@qwik.dev/router/middleware/node';
import qwikRouterConfig from '@qwik-router-config';
// make sure qwikCityPlan is imported before entry
import render from './entry.ssr';

/** The default export is the QwikCity adapter used by Vite preview. */
export default createQwikRouter({ render, qwikRouterConfig });
export default createQwikRouter({ render });
7 changes: 7 additions & 0 deletions e2e/adapters-e2e/tests/express.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { expect, test } from '@playwright/test';

test.beforeEach(async ({ page }) => {
page.on('console', (msg) => {
// eslint-disable-next-line no-console
console.log(`[browser ${msg.type()}] ${msg.text()}`);
});
});

test.describe('Verifying Express Adapter', () => {
test('should ignore unknown qdata', async ({ page, request }) => {
page.goto('/');
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/adapters/cloudflare-pages/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default extendConfig(baseConfig, () => {
build: {
ssr: true,
rollupOptions: {
input: ['src/entry.cloudflare-pages.tsx', '@qwik-router-config'],
input: ['src/entry.cloudflare-pages.tsx'],
},
minify: false,
},
Expand All @@ -18,7 +18,7 @@ export default extendConfig(baseConfig, () => {
exclude: ['/demo/*', '/shop/*'],
origin:
(process.env.CF_PAGES_BRANCH !== 'main' ? process.env.CF_PAGES_URL : null) ??
'https://qwik.builder.io',
'https://qwik.dev',
},
}),
],
Expand Down
22 changes: 2 additions & 20 deletions packages/docs/public/_routes.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
{
"version": 1,
"include": ["/*"],
"exclude": [
"/chat",
"/examples",
"/guide",
"/tutorial",
"/tutorials",
"/tutorial/hooks/use-client-effect/",
"/docs/overview/",
"/docs/cheat/qwik-react/",
"/docs/cheat/best-practices/",
"/docs/cheat/serialization/",
"/docs/components/lifecycle/",
"/docs/components/projection/",
"/docs/components/resource/",
"/qwikcity/*",
"/integrations/*",
"/deployments/*",
"/repl/*"
]
"include": ["/playground/*", "/tutorial/*", "/demo/*"],
"exclude": []
}
3 changes: 1 addition & 2 deletions packages/docs/src/entry.cloudflare-pages.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import qwikRouterConfig from '@qwik-router-config';
import { createQwikRouter } from '@qwik.dev/router/middleware/cloudflare-pages';
import render from './entry.ssr';

const fetch = createQwikRouter({ render, qwikRouterConfig });
const fetch = createQwikRouter({ render });

export { fetch };
3 changes: 1 addition & 2 deletions packages/docs/src/entry.preview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import qwikRouterConfig from '@qwik-router-config';
import { createQwikRouter } from '@qwik.dev/router/middleware/node';
import render from './entry.ssr';

/** The default export is the QwikRouter adapter used by Vite preview. */
export default createQwikRouter({ render, qwikRouterConfig });
export default createQwikRouter({ render });
10 changes: 5 additions & 5 deletions packages/docs/src/routes/api/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import qwikRouterMiddlewareNetlifyEdgeApiData from './qwik-router-middleware-net
import qwikRouterMiddlewareNodeApiData from './qwik-router-middleware-node/api.json';
import qwikRouterMiddlewareRequestHandlerApiData from './qwik-router-middleware-request-handler/api.json';
import qwikRouterMiddlewareVercelEdgeApiData from './qwik-router-middleware-vercel-edge/api.json';
import qwikRouterStaticApiData from './qwik-router-static/api.json';
import qwikRouterSsgApiData from './qwik-router-ssg/api.json';
import qwikRouterViteAzureSwaApiData from './qwik-router-vite-azure-swa/api.json';
import qwikRouterViteCloudRunApiData from './qwik-router-vite-cloud-run/api.json';
import qwikRouterViteCloudflarePagesApiData from './qwik-router-vite-cloudflare-pages/api.json';
import qwikRouterViteNetlifyEdgeApiData from './qwik-router-vite-netlify-edge/api.json';
import qwikRouterViteNodeServerApiData from './qwik-router-vite-node-server/api.json';
import qwikRouterViteStaticApiData from './qwik-router-vite-static/api.json';
import qwikRouterViteSsgApiData from './qwik-router-vite-ssg/api.json';
import qwikRouterViteVercelApiData from './qwik-router-vite-vercel/api.json';
import qwikRouterApiData from './qwik-router/api.json';
import qwikServerApiData from './qwik-server/api.json';
Expand All @@ -35,13 +35,13 @@ const apiData = {
'qwik-router-middleware-request-handler': qwikRouterMiddlewareRequestHandlerApiData,
'qwik-router-middleware-vercel-edge': qwikRouterMiddlewareVercelEdgeApiData,
'qwik-router-middleware-firebase': qwikRouterMiddlewareFirebaseApiData,
'qwik-router-static': qwikRouterStaticApiData,
'qwik-router-ssg': qwikRouterSsgApiData,
'qwik-router-vite-azure-swa': qwikRouterViteAzureSwaApiData,
'qwik-router-vite-cloud-run': qwikRouterViteCloudRunApiData,
'qwik-router-vite-cloudflare-pages': qwikRouterViteCloudflarePagesApiData,
'qwik-router-vite-node-server': qwikRouterViteNodeServerApiData,
'qwik-router-vite-netlify-edge': qwikRouterViteNetlifyEdgeApiData,
'qwik-router-vite-static': qwikRouterViteStaticApiData,
'qwik-router-vite-ssg': qwikRouterViteSsgApiData,
'qwik-router-vite-vercel': qwikRouterViteVercelApiData,
'qwik-optimizer': qwikOptimizerApiData,
'qwik-server': qwikServerApiData,
Expand Down Expand Up @@ -126,7 +126,7 @@ export const ApiMemberWrapper = component$(({ id, data, filters }: any) => {
<h2
data-icon={isCollapsed.value ? '→' : '↓'}
class="section-title cursor-pointer"
onClick$={(e) => isCollapsed.value = !isCollapsed.value }
onClick$={() => isCollapsed.value = !isCollapsed.value }
>
<span>{data.id}</span>
</h2>
Expand Down
8 changes: 4 additions & 4 deletions packages/docs/src/routes/api/qwik-optimizer/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
}
],
"kind": "Enum",
"content": "Use `__EXPERIMENTAL__.x` to check if feature `x` is enabled. It will be replaced with `true` or `false` via an exact string replacement.\n\nAdd experimental features to this enum definition.\n\n\n```typescript\nexport declare enum ExperimentalFeatures \n```\n\n\n<table><thead><tr><th>\n\nMember\n\n\n</th><th>\n\nValue\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nenableRequestRewrite\n\n\n</td><td>\n\n`\"enableRequestRewrite\"`\n\n\n</td><td>\n\nEnable request.rewrite()\n\n\n</td></tr>\n<tr><td>\n\ninsights\n\n\n</td><td>\n\n`\"insights\"`\n\n\n</td><td>\n\nEnable the ability to use the Qwik Insights vite plugin and <Insights/> component\n\n\n</td></tr>\n<tr><td>\n\nnoSPA\n\n\n</td><td>\n\n`\"noSPA\"`\n\n\n</td><td>\n\nDisable SPA navigation handler in Qwik Router\n\n\n</td></tr>\n<tr><td>\n\npreventNavigate\n\n\n</td><td>\n\n`\"preventNavigate\"`\n\n\n</td><td>\n\nEnable the usePreventNavigate hook\n\n\n</td></tr>\n<tr><td>\n\nvalibot\n\n\n</td><td>\n\n`\"valibot\"`\n\n\n</td><td>\n\nEnable the Valibot form validation\n\n\n</td></tr>\n<tr><td>\n\nwebWorker\n\n\n</td><td>\n\n`\"webWorker\"`\n\n\n</td><td>\n\nEnable worker$\n\n\n</td></tr>\n</tbody></table>",
"content": "Use `__EXPERIMENTAL__.x` to check if feature `x` is enabled. It will be replaced with `true` or `false` via an exact string replacement.\n\nAdd experimental features to this enum definition.\n\n\n```typescript\nexport declare enum ExperimentalFeatures \n```\n\n\n<table><thead><tr><th>\n\nMember\n\n\n</th><th>\n\nValue\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nenableRequestRewrite\n\n\n</td><td>\n\n`\"enableRequestRewrite\"`\n\n\n</td><td>\n\nEnable request.rewrite()\n\n\n</td></tr>\n<tr><td>\n\ninsights\n\n\n</td><td>\n\n`\"insights\"`\n\n\n</td><td>\n\nEnable the ability to use the Qwik Insights vite plugin and `<Insights/>` component\n\n\n</td></tr>\n<tr><td>\n\nnoSPA\n\n\n</td><td>\n\n`\"noSPA\"`\n\n\n</td><td>\n\nDisable SPA navigation handler in Qwik Router\n\n\n</td></tr>\n<tr><td>\n\npreventNavigate\n\n\n</td><td>\n\n`\"preventNavigate\"`\n\n\n</td><td>\n\nEnable the usePreventNavigate hook\n\n\n</td></tr>\n<tr><td>\n\nvalibot\n\n\n</td><td>\n\n`\"valibot\"`\n\n\n</td><td>\n\nEnable the Valibot form validation\n\n\n</td></tr>\n<tr><td>\n\nwebWorker\n\n\n</td><td>\n\n`\"webWorker\"`\n\n\n</td><td>\n\nEnable worker$\n\n\n</td></tr>\n</tbody></table>",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/plugins/plugin.ts",
"mdFile": "core.experimentalfeatures.md"
},
Expand Down Expand Up @@ -754,8 +754,8 @@
}
],
"kind": "Variable",
"content": "> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nFor a given symbol (QRL such as `onKeydown$`<!-- -->) the server needs to know which bundle the symbol is in.\n\nNormally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full client build.\n\nThis would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL using the symbolMapper function below. For Vite the given path is fixed for a given symbol.\n\n\n```typescript\nsymbolMapper: ReturnType<typeof createSymbolMapper>\n```",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/plugins/vite-dev-server.ts",
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\n> Warning: This API is now obsolete.\n> \n> No longer needed, it is automatic now\n> \n\n\n```typescript\nsymbolMapper: undefined\n```",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/index.ts",
"mdFile": "core.symbolmapper.md"
},
{
Expand All @@ -768,7 +768,7 @@
}
],
"kind": "TypeAlias",
"content": "> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nFor a given symbol (QRL such as `onKeydown$`<!-- -->) the server needs to know which bundle the symbol is in.\n\nNormally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full client build.\n\nThis would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL using the symbolMapper function below. For Vite the given path is fixed for a given symbol.\n\n\n```typescript\nsymbolMapper: ReturnType<typeof createSymbolMapper>\n```",
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\n> Warning: This API is now obsolete.\n> \n> No longer needed, it is automatic now\n> \n\n\n```typescript\nsymbolMapper: undefined\n```",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/types.ts",
"mdFile": "core.symbolmapper.md"
},
Expand Down
28 changes: 12 additions & 16 deletions packages/docs/src/routes/api/qwik-optimizer/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ insights

</td><td>

Enable the ability to use the Qwik Insights vite plugin and <Insights/> component
Enable the ability to use the Qwik Insights vite plugin and `<Insights/>` component

</td></tr>
<tr><td>
Expand Down Expand Up @@ -3090,32 +3090,28 @@ export type SourceMapsOption = "external" | "inline" | undefined | null;

## symbolMapper

> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

For a given symbol (QRL such as `onKeydown$`) the server needs to know which bundle the symbol is in.

Normally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full client build.

This would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL using the symbolMapper function below. For Vite the given path is fixed for a given symbol.
> Warning: This API is now obsolete.
>
> No longer needed, it is automatic now

```typescript
symbolMapper: ReturnType<typeof createSymbolMapper>;
symbolMapper: undefined;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/plugins/vite-dev-server.ts)
[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/index.ts)

## SymbolMapper

> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

For a given symbol (QRL such as `onKeydown$`) the server needs to know which bundle the symbol is in.

Normally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full client build.
> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

This would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL using the symbolMapper function below. For Vite the given path is fixed for a given symbol.
> Warning: This API is now obsolete.
>
> No longer needed, it is automatic now

```typescript
symbolMapper: ReturnType<typeof createSymbolMapper>;
symbolMapper: undefined;
```

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/types.ts)
Expand Down
Loading
Loading