Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(chore) - create Preact example #1636

Closed
wants to merge 5 commits into from

Conversation

JoviDeCroock
Copy link

This PR makes a version of the examples/basic app leveraging Preact. The only thing that stands out here is the "hack" we have to do in Preact to make the hydrate(x, document) work correctly.

There's an additional fix to be found in the remix-dev CLI, when missing a package like React (or in my case Preact... Yes I forgot to install Preact 😂) it would print out that the dev cli was missing, which had me confused for quite a while. Now it will take the first line of the error message, which is the same it was before, and leverage that to indicate the missing module.

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jan 24, 2022

Hi @JoviDeCroock,

Welcome, and thank you for contributing to Remix!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jan 24, 2022

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@JoviDeCroock JoviDeCroock mentioned this pull request Jan 24, 2022
3 tasks

const documentElement = document.documentElement;
const apply = (n: HTMLElement) => document.replaceChild(n, documentElement);
// Temp fix
Copy link
Author

Choose a reason for hiding this comment

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

Preact currently fails when passing in document as that has a few nodes that aren't reconcilable 😅

@phiberber
Copy link

Does this also apply Preact for production? How are you checking for Preact in the website?

@JoviDeCroock
Copy link
Author

The npm deps replace React with Preact, verified production bundles :)

examples/basic-preact/app/root.tsx Outdated Show resolved Hide resolved
@ryanflorence
Copy link
Member

We've been working (sporadically, our fault) with @developit on this. I'm going to close this but welcome it being reopened when we announce official Preact support :)

@ryanflorence
Copy link
Member

To be clear, we will support Preact "natively". No compat layer so we can get the client bundle even smaller :)

@JoviDeCroock JoviDeCroock deleted the preact-example branch February 10, 2022 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants