HackTJ / 2021

The source code for HackTJ 8.0's website.
https://hacktj.org/2021
0 stars 0 forks source link

Switch to Preact #12

Open sumanthratna opened 3 years ago

sumanthratna commented 3 years ago

will save us many kb

I considered using vite or wmr but ~neither supports prerendering out of the box~ so I went with preact-cli

closes https://github.com/HackTJ/2021/issues/9

TODO:

rschristian commented 3 years ago

Just came from the linked Preact issue (sorry, was just taking a peek) but WMR does in fact come with prerendering right out of the box: https://github.com/preactjs/wmr/blob/91bc136e5c4a47c3ee3613e4d65183f4160ebe8e/packages/create-wmr/tpl/package.json#L2-L6

Linked is the pkg.json of the template that all new projects are created with. Prerendering is a flag but one we ship with.

sumanthratna commented 3 years ago

Just came from the linked Preact issue (sorry, was just taking a peek) but WMR does in fact come with prerendering right out of the box: https://github.com/preactjs/wmr/blob/91bc136e5c4a47c3ee3613e4d65183f4160ebe8e/packages/create-wmr/tpl/package.json#L2-L6

Linked is the pkg.json of the template that all new projects are created with. Prerendering is a flag but one we ship with.

Thanks for taking a look @rschristian! :)

I read the npm README and it suggested using preact-iso instead of Preact.render so I assumed there was no out-of-the-box way to pretender Preact apps with wmr. It might help others if the --prerender flag is mentioned somewhere in the README. Thanks for letting me know though; I'll take another look at wmr.

rschristian commented 3 years ago

@sumanthratna

Ah, yeah. If you look that section has the header "Manual Installation and Setup". If you initialize with our template it is "out of the box" but I can see what you mean, the prerender functionality technically doesn't come with WMR itself.

I guess it's a bit of a different setup, but preact-iso was basically created to be a set of tools for WMR: prerendering, lazy loading, router, etc. WMR itself has the flag to prerender but the functionality does come from elsewhere.