preact-cli
preact-cli copied to clipboard
Prerendering with lazy and suspense(Template execution failed: [object Promise])
Hey guys, I want to have structure like this:
App.js:
import { Suspense, lazy } from 'preact/compat'
import Preloader from "../components/Preloader/Preloader"
const Comp1= lazy(() => import('../routes/Comp1/Comp1'))
const Comp2= lazy(() => import('../routes/Comp2/Comp2'))
...
export default () => {
return (
<Suspense fallback={<Preloader />}>
<Router>
<Route path="/" component={Comp1} />
<Route path="/comp2" component={Comp2} />
It's simple routing with preloader till any new page load. dev server and build without prerendering working, but I want to have structure like this prerendered. If we try to build structure above there is "Template execution failed: [object Promise]" error.
I've tried: -preact-async-route and AsyncRoute component. Current version asks to use lazy/suspense. With AsyncRoute I was getting errors too. -"async!" flag in imports - It didn't help much either - there are were errors as well. -moving pages to "routes" folder doesn't help to split at all - I've got the same size of chunks.
I parsed all documentation I found and still have no clue what would be the "right" way to implement it.
We'll need to include something like preact-ssr-prepass
for this to work, this can resolve these promises and load the UI.
We'll need to include something like
preact-ssr-prepass
for this to work, this can resolve these promises and load the UI.
Any way I can make it work now?
would be interested in this as well