The only documentation I was able to find is this - https://preactjs.com/guide/switching-to-preact
but it seems like it's not relevant to preact-cli since they mentions webpack.config.js which doesn't exist in preact-cli.
It would be great to have a how-to guide as part of the official preact-cli (as part of the website or just a markdown file inside a docs folder in the repo) that guide new users in using react components.
Preact-cli includes preact-compat by default but prerender will choke on it. See #62 for details
So the workaround is to build without prerender?
Is this work around temporary? I am asking since based on my understanding the prerender is important for improving the performance of the first page the user interact with.
It's temporary. There is an open PR that use webpack to generate SSR instead of nide. Once it's merged, this will be fixed
Preact-cli includes preact-compat by default
That explains why the slider component I am am playing with works without me adding preact-compat! Also, this guide is not accurate for preact-cli.
Do you think the fact that preact-compat comes with preact-cli should be mentioned somewhere in preact docs? This is important fact that will save new users a lot of time.
No. preact-cli and preact are two separate packages entirely. One is merely a getting-started-cli tool for the other.
sorry. I wrote 'in preact docs' but meant 'preact-cli' docs (:
The workaround worked. Here is the error I get and the solution, in case anyone else have this issue:
npm run build
Template execution failed: Error: Cannot find module 'react'
Error: Cannot find module 'react'
- prerender.js:43 Function.Module._resolveFilename
[preact-range]/[preact-cli]/lib/lib/prerender.js:43:21
And the workaround:
npm run build -- --no-prerender
Will be fixed by #71.
Most helpful comment
That explains why the slider component I am am playing with works without me adding preact-compat! Also, this guide is not accurate for preact-cli.
Do you think the fact that preact-compat comes with preact-cli should be mentioned somewhere in preact docs? This is important fact that will save new users a lot of time.