Skip to content

Commit

Permalink
fix: fix rolldown_runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Nov 14, 2024
1 parent e67ffe3 commit 1879e43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 0 additions & 4 deletions viteroll/examples/ssr/src/entry-server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ const handler: Connect.SimpleHandleFunction = (req, res) => {
};

export default handler;

if (typeof module !== "undefined") {
(module as any).hot.accept();
}
12 changes: 11 additions & 1 deletion viteroll/viteroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,21 @@ function viterollEntryPlugin(
);
// trigger full rebuild on non-accepting entry invalidation
output
.replace(
"this.executeModuleStack.length > 1",
"this.executeModuleStack.length >= 1",
)
.replace("parents: [parent],", "parents: parent ? [parent] : [],")
.replace(
"if (module.parents.indexOf(parent) === -1) {",
"if (parent && module.parents.indexOf(parent) === -1) {",
)
.replace(
"for (var i = 0; i < module.parents.length; i++) {",
`
if (module.parents.length === 0) {
boundaries.push(moduleId);
invalidModuleIds.push(moduleId);
if (module.parents.filter(Boolean).length === 0) {
__rolldown_hot.send("rolldown:hmr-deadend", { moduleId });
break;
}
Expand Down

0 comments on commit 1879e43

Please sign in to comment.