Skip to content

Commit 11472ca

Browse files
committed
fix: ignore dynamic pages when export static website
User reported vike broke when published website with dynamic 404 page (/*). Here fixed by ignoring any pattern paths.
1 parent 87312f8 commit 11472ca

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

packages/cli/src/framework-vike-ssg.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { join } from "node:path";
22
import { readFile, rm } from "node:fs/promises";
3-
import type { WsComponentMeta } from "@webstudio-is/sdk";
3+
import { isPathnamePattern, type WsComponentMeta } from "@webstudio-is/sdk";
44
import * as baseComponentMetas from "@webstudio-is/sdk-components-react/metas";
55
import * as animationComponentMetas from "@webstudio-is/sdk-components-animation/metas";
66
import * as radixComponentMetas from "@webstudio-is/sdk-components-react-radix/metas";
@@ -59,20 +59,26 @@ export const createFramework = async (): Promise<Framework> => {
5959
metas: radixComponentNamespacedMetas,
6060
},
6161
],
62-
html: ({ pagePath }: { pagePath: string }) => [
63-
{
64-
file: join("pages", generateVikeRoute(pagePath), "+Page.tsx"),
65-
template: htmlPageTemplate,
66-
},
67-
{
68-
file: join("pages", generateVikeRoute(pagePath), "+Head.tsx"),
69-
template: htmlHeadTemplate,
70-
},
71-
{
72-
file: join("pages", generateVikeRoute(pagePath), "+data.ts"),
73-
template: htmlDataTemplate,
74-
},
75-
],
62+
html: ({ pagePath }: { pagePath: string }) => {
63+
// ignore dynamic pages in static export
64+
if (isPathnamePattern(pagePath)) {
65+
return [];
66+
}
67+
return [
68+
{
69+
file: join("pages", generateVikeRoute(pagePath), "+Page.tsx"),
70+
template: htmlPageTemplate,
71+
},
72+
{
73+
file: join("pages", generateVikeRoute(pagePath), "+Head.tsx"),
74+
template: htmlHeadTemplate,
75+
},
76+
{
77+
file: join("pages", generateVikeRoute(pagePath), "+data.ts"),
78+
template: htmlDataTemplate,
79+
},
80+
];
81+
},
7682
xml: () => [],
7783
redirect: () => [],
7884
defaultSitemap: () => [],

0 commit comments

Comments
 (0)