summaryrefslogtreecommitdiff
path: root/src/frontend/render
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-03-25 14:06:08 -0400
committerGravatar GitHub <noreply@github.com> 2021-03-25 14:06:08 -0400
commit3db595937719b89956c594e4a76ee68ae8de098a (patch)
treee463889925f71539f28730f957b195b1806b3cb0 /src/frontend/render
parent18e7cc5af903543ac6f46780bfea67c13c6517df (diff)
downloadastro-3db595937719b89956c594e4a76ee68ae8de098a.tar.gz
astro-3db595937719b89956c594e4a76ee68ae8de098a.tar.zst
astro-3db595937719b89956c594e4a76ee68ae8de098a.zip
First pass at the build (#27)
This updates `astro build` to do a production build. It works! No optimizations yet.
Diffstat (limited to 'src/frontend/render')
-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,