summaryrefslogtreecommitdiff
path: root/src/frontend/render/preact.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/render/preact.ts')
-rw-r--r--src/frontend/render/preact.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/frontend/render/preact.ts b/src/frontend/render/preact.ts
index 3b9e1e6d8..50bb9344e 100644
--- a/src/frontend/render/preact.ts
+++ b/src/frontend/render/preact.ts
@@ -1,10 +1,13 @@
-import render from 'preact-render-to-string';
-import { h } from 'preact';
+import renderToString from 'preact-render-to-string';
+import { h, render } from 'preact';
import type { Component } from 'preact';
+// This prevents tree-shaking of render.
+Function.prototype(render);
+
export function __preact_static(PreactComponent: Component) {
return (attrs: Record<string, any>, ...children: any): string => {
- let html = render(
+ let html = renderToString(
h(
PreactComponent as any, // Preact's types seem wrong...
attrs,