Updates
This commit is contained in:
@@ -20,8 +20,9 @@ export default async function allPagesESBuildContextBundler(params) {
|
||||
const tsx = await grabClientHydrationScript({
|
||||
page_local_path: page.local_path,
|
||||
});
|
||||
if (!tsx)
|
||||
if (!tsx) {
|
||||
continue;
|
||||
}
|
||||
const entryFile = path.join(BUNX_HYDRATION_SRC_DIR, `${page.url_path}.tsx`);
|
||||
// await Bun.write(entryFile, txt, { createPath: true });
|
||||
entryToPage.set(entryFile, { ...page, tsx });
|
||||
|
||||
+5
-1
@@ -16,7 +16,9 @@ export default async function pagesSSRBundler(params) {
|
||||
for (const page of pages) {
|
||||
if (page.local_path.match(/\/pages\/api\//)) {
|
||||
const ts = await Bun.file(page.local_path).text();
|
||||
entryToPage.set(page.local_path, { ...page, tsx: ts });
|
||||
if (ts.match(/(export default)|(export \w+ handler)/)) {
|
||||
entryToPage.set(page.local_path, { ...page, tsx: ts });
|
||||
}
|
||||
continue;
|
||||
}
|
||||
const tsx = grabPageReactComponentString({
|
||||
@@ -25,6 +27,8 @@ export default async function pagesSSRBundler(params) {
|
||||
});
|
||||
if (!tsx)
|
||||
continue;
|
||||
if (!tsx.match(/export default/))
|
||||
continue;
|
||||
entryToPage.set(page.local_path, { ...page, tsx });
|
||||
}
|
||||
const entryPoints = [...entryToPage.keys()].map((e) => `ssr-virtual:${e}`);
|
||||
|
||||
@@ -16,6 +16,9 @@ export default function ssrVirtualFilesPlugin({ entryToPage }) {
|
||||
if (!target?.tsx)
|
||||
return null;
|
||||
const contents = target.tsx;
|
||||
if (!contents.match(/export/)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
contents: contents || "",
|
||||
loader: "tsx",
|
||||
|
||||
Reference in New Issue
Block a user