preact-render-to-string icon indicating copy to clipboard operation
preact-render-to-string copied to clipboard

renderToStringAsync seems to be unexported

Open i124q2n8 opened this issue 11 months ago • 0 comments

I am using [email protected] and might have found a bug (or I just have skill issues). Thanks in advance!

My code looks something like that:

async function renderPage() {
  const res = await renderToStringAsync(<Page />);
}

I get the following error. preact_render_to_string_1.renderToStringAsync is not a function.

Is it possible that you forgot to add this function here: https://github.com/preactjs/preact-render-to-string/blob/637b3021ff05a0729a1a7c0eb965ce3fc3556af6/config/node-commonjs.js#L13-L19

Additional context

To get more information about the module and the exports i ran the following code:

import preact, {
  renderToStringAsync,
  renderToString,
} from "preact-render-to-string";

console.log(preact);
console.log(renderToString);
console.log(renderToStringAsync);

Console:

<ref *1> [Function: w] {
  renderToStaticMarkup: [Circular *1],
  renderToString: [Circular *1],
  render: [Circular *1]
}
<ref *1> [Function: w] {
  renderToStaticMarkup: [Circular *1],
  renderToString: [Circular *1],
  render: [Circular *1]
}
undefined

i124q2n8 avatar Mar 19 '24 05:03 i124q2n8