astro/packages/renderers/renderer-preact
Matthew Phillips 271cfe6ce3
Improved JSX framework detection (#382)
* Improved JSX framework detection

This improves the JSX detection and adds a bunch of test. The following is improved:

* If an error throws because of a coding mistake, those errors will be reported.
* We properly detect class components for both Preact and React. We don't have to "try to render" these.

It's still possible that error messages might be obscured in this scenario:

A Preact function component that uses hooks (or another preact specific feature) that has a coding mistake. The React renderer might throw when it uses the Preact hook. That error will be reported rather than the real coding mistake.

This is because we can't distinguish between errors that are due to the wrong framework and errors that the user caused.

I might reach out to the Preact community and see if they can think of a better solution to this problem. This will come up when other JSX based frameworks have renderers. I still think that having multiple frameworks in the same project is a feature worth trying to preserve.

* Move try/catch into the __astro_component
2021-06-14 08:35:25 -04:00
..
CHANGELOG.md Version Packages (#285) 2021-06-02 12:49:05 -04:00
client.js Bugbash! (#263) 2021-05-28 17:19:40 -05:00
index.js Bugbash! (#263) 2021-05-28 17:19:40 -05:00
package.json add engines for esm support (#415) 2021-06-14 08:20:14 -04:00
server.js Improved JSX framework detection (#382) 2021-06-14 08:35:25 -04:00
static-html.js Bugbash! (#263) 2021-05-28 17:19:40 -05:00