Skip to content

3.0.2

Compare
Choose a tag to compare
@developit developit released this 03 Aug 00:48
· 532 commits to main since this release

TL;DR: 3.0.0's {jsx:true} option has been replaced with preact-render-to-string/jsx.

3.0.0 added support for test-style JSX rendering (complex attributes rendered out using pretty-format). However, pretty-format actually doubled the size of preact-render-to-string and broke support for Node 4 and prior.

Instead of adding weight to the core library, which is often used in browsers (this library is part of preact-compat, for example), it's better to support these two "modes" via separate entrypoints into the module.

Here's the new solution - the library is now split into two different entrypoints, one for HTML/XML rendering, and the other specialized entry for JSX-style debug rendering.

Normal Mode

import renderToString from 'preact-render-to-string';

JSX-Style Mode (for test frameworks, debugging, etc)

import renderToString from 'preact-render-to-string/jsx';