@hyperspan/plugin-preact 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperspan/plugin-preact",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Hyperspan Plugin for Preact",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -128,12 +128,12 @@ ${componentName}.__HS_ISLAND = {
128
128
  id: "${jsId}",
129
129
  render: (props, options = {}) => {
130
130
  if (options.ssr === false) {
131
- const jsContent = \`__hs_render(__hs_h(${componentName}, \${JSON.stringify(props)}), document.getElementById("${jsId}"));\`;
131
+ const jsContent = \`import { h as __hs_h, render as __hs_render } from 'preact';__hs_render(__hs_h(${componentName}, \${JSON.stringify(props)}), document.getElementById("${jsId}"));\`;
132
132
  return __hs_renderIsland(jsContent, '', options);
133
133
  }
134
134
 
135
135
  const ssrContent = __hs_renderToString(__hs_h(${componentName}, props));
136
- const jsContent = \`__hs_hydrate(__hs_h(${componentName}, \${JSON.stringify(props)}), document.getElementById("${jsId}"));\`;
136
+ const jsContent = \`import { h as __hs_h, hydrate as __hs_hydrate } from 'preact';__hs_hydrate(__hs_h(${componentName}, \${JSON.stringify(props)}), document.getElementById("${jsId}"));\`;
137
137
  return __hs_renderIsland(jsContent, ssrContent, options);
138
138
 
139
139
  }