Skip to content

Commit 7726a3a

Browse files
committed
fix: inject dev html for playground correctly
1 parent b65dcdf commit 7726a3a

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

packages/docs/src/repl/worker/repl-request-handler.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,6 @@ export const requestHandler = (ev: FetchEvent) => {
3030
return htmlRsp;
3131
}
3232

33-
// app client modules
34-
// const replEvent: ReplEventMessage = {
35-
// type: 'event',
36-
// clientId,
37-
// event: {
38-
// kind: 'client-module',
39-
// scope: 'network',
40-
// message: [reqUrl.pathname + reqUrl.search],
41-
// start: performance.now(),
42-
// },
43-
// };
44-
45-
// sendMessageToReplServer(replEvent);
46-
4733
return rsp;
4834
}
4935

@@ -169,5 +155,9 @@ const injectDevHtml = (clientId: string, html?: string) => {
169155
}, true);
170156
})();`;
171157

172-
return `<script :>${s}</script>${html || ''}`;
158+
if (!html) {
159+
return '';
160+
}
161+
162+
return html.replace(/<\/body>/i, `<script>${s}</script></body>`);
173163
};

0 commit comments

Comments
 (0)