Skip to content

Commit 00ea67d

Browse files
committed
fix(cli): transpile Nuxt style deps and stop pinning the Vite dev host
Add @zitadel/shared-component-styles and @zitadel/design-tokens to the Nuxt build.transpile list, matching the repo's demo-nuxt config, so SSR builds don't fail on their untranspiled ESM. Stop setting server.host in the Vite config edit: it duplicated Vite's default and got in the way of opting into network binding; the issuer/origin requirement is about the port, which is still set.
1 parent ac58f3c commit 00ea67d

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

apps/cli/src/lib/orca/patchers/rule/nuxt/nuxt-config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,14 @@ export function nuxtConfigEdit(opts: {
5252
);
5353
}
5454

55-
// The Lit components must be transpiled for SSR.
55+
// The Lit components and their style/token deps must be transpiled for SSR
56+
// (matching the repo's own demo-nuxt config) or the build fails on the
57+
// untranspiled ESM those transitive packages ship.
5658
const build = ensureEditableObject(config, "build");
5759
ensureArrayItem(build, "transpile", "@zitadel/api");
5860
ensureArrayItem(build, "transpile", "@zitadel/components");
61+
ensureArrayItem(build, "transpile", "@zitadel/shared-component-styles");
62+
ensureArrayItem(build, "transpile", "@zitadel/design-tokens");
5963

6064
// Tell Vue's template compiler the `zitadel-*` Lit elements are custom
6165
// elements, not Vue components, so it renders them as native elements

apps/cli/src/lib/orca/patchers/rule/vite-support.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ const PROXY_IMPORTS = [
4444
/**
4545
* Builds the pure `edit` transform the file-writer applies to the project's Vite
4646
* config (`vite.config.*`): a non-destructive magicast merge that adds the
47-
* `/__nextgen` proxy and sets `server.host`/`server.port`/`strictPort` when they
48-
* are unset, preserving the user's plugins, options, and formatting. Idempotent
47+
* `/__nextgen` proxy and sets `server.port`/`strictPort` when they are unset,
48+
* preserving the user's plugins, options, and formatting. Leaves `server.host`
49+
* alone so the user can still opt into network binding (`--host`/`host: true`);
50+
* the issuer/origin requirement is about the port, not the bind host. Idempotent
4951
* — entries already present are left as-is. Throws `E_VALIDATION` when the file
5052
* is absent or the config object cannot be reached (function-built/exotic
5153
* configs), with a hint to add the block manually.
@@ -59,9 +61,6 @@ export function viteProxyEdit(
5961
const mod = parseConfigModule(source, label);
6062
const config = resolveDefaultExportObject(mod, label);
6163
const serverConfig = ensureEditableObject(config, "server");
62-
if (serverConfig.host === undefined) {
63-
serverConfig.host = "localhost";
64-
}
6564
if (serverConfig.port === undefined) {
6665
serverConfig.port = devPort;
6766
}

apps/cli/tests/unit/lib/orca/patchers/rule/nuxt/nuxt-config.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ describe("nuxtConfigEdit", () => {
1313
expect(out).toContain("process.env.ZITADEL_URL");
1414
expect(out).toContain("process.env.NUXT_PUBLIC_ZITADEL_PROJECT_ID");
1515
expect(out).toContain("@zitadel/components");
16+
expect(out).toContain("@zitadel/shared-component-styles");
17+
expect(out).toContain("@zitadel/design-tokens");
1618
expect(out).toContain("isCustomElement");
1719
expect(out).toContain('tag.startsWith("zitadel-")');
1820
});

apps/cli/tests/unit/lib/orca/patchers/rule/vite-support.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ describe("viteProxyEdit", () => {
3333
expect(out).not.toContain("5173");
3434
});
3535

36+
it("leaves server.host unset so the user can opt into network binding", () => {
37+
const out = edit("export default defineConfig({});");
38+
expect(out).not.toContain("host:");
39+
});
40+
3641
it("is idempotent — re-running over its own output changes nothing", () => {
3742
const once = edit("export default defineConfig({});");
3843
expect(edit(once)).toBe(once);

0 commit comments

Comments
 (0)