Skip to content

Conversation

@vaneenige
Copy link
Member

This PR changes the external option for the build script from none to preact which resolves the crash when using hooks. (preactjs/preact#1373)

The test for hooks ran fine when using the src, but crashed when using dist (the __h of undefined error). The reason for this was that with external option set to none resulted in the imported options from preact being an empty object (so options.render would not be called and hooks would crash).

https://github.com/developit/preact-render-to-string/blob/8536c758e3d1808bcc18d64cd944da609531d11e/src/index.js#L66

Result difference in build:

Before:
1510 B (mjs)
1567 B (js)

After:
1487 B (mjs)
1549 B (js)

Difference:
-23 B (mjs)
-18 B (js)

Copy link
Member

@developit developit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh good catch!

@developit developit merged commit fd7fa37 into preactjs:master Mar 15, 2019
@sync
Copy link

sync commented Mar 15, 2019

Tested this and with this fix no more crash, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants