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
5 changes: 5 additions & 0 deletions .changeset/dirty-tools-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/qwik-city': patch
---

fix: `zod` is now imported as `import * as z from 'zod'`, which vastly improves bundling. The Insights app client code reduced by 12kB.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The initialization process will create some important files for you.

### Declare Route Details
```typescript title="/src/routes/pokemon/[pokemonId]/routeInfo.ts"
import { z } from "zod";
import * as z from "zod";

export const Route = {
name: "PokemonDetail",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { z } from 'zod';
import * as z from 'zod';

export const ApplicationForm = z.object({
name: z.string().min(1, 'Application name is required.'),
Expand Down
2 changes: 1 addition & 1 deletion packages/insights/src/types/q-manifest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { z } from 'zod';
import * as z from 'zod';

export const QManifestSymbol = z.object({
origin: z.string(),
Expand Down
9 changes: 8 additions & 1 deletion packages/qwik-city/src/buildtime/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ function qwikCityPlugin(userOpts?: QwikCityVitePluginOptions): any {
},
ssr: {
external: ['node:async_hooks'],
noExternal: [QWIK_CITY, QWIK_CITY_PLAN_ID, QWIK_CITY_ENTRIES_ID, QWIK_CITY_SW_REGISTER],
noExternal: [
QWIK_CITY,
QWIK_CITY_PLAN_ID,
QWIK_CITY_ENTRIES_ID,
QWIK_CITY_SW_REGISTER,
// We've had reports of bundling issues with zod
'zod',
],
},
};
return updatedViteConfig;
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-city/src/runtime/src/server-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '@builder.io/qwik';

import * as v from 'valibot';
import { z } from 'zod';
import * as z from 'zod';
import type { RequestEventLoader } from '../../middleware/request-handler/types';
import { QACTION_KEY, QDATA_KEY, QFN_KEY } from './constants';
import { RouteStateContext } from './contexts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expectTypeOf, test } from 'vitest';
import { z } from 'zod';
import * as z from 'zod';
import { server$ } from './server-functions';
import type { RequestEventBase, ValidatorErrorType } from './types';

Expand Down
2 changes: 1 addition & 1 deletion packages/qwik-labs/src/insights/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { component$, sync$ } from '@builder.io/qwik';
import { z } from 'zod';
import * as z from 'zod';

export interface InsightsPayload {
/** Qwik version */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
zod$,
} from "@builder.io/qwik-city";
import { isUserAuthenticated, signIn } from "../../../../auth/auth";
import { z } from "zod";
import * as z from "zod";

export const onGet: RequestHandler = async ({ redirect, cookie }) => {
if (await isUserAuthenticated(cookie)) {
Expand Down
Loading