You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Static browser assets to be served
// https://example.com
pages/dist/staticDir/index.html
pages/dist/staticDir/bundle1.js
// https://example.com/about
pages/dist/staticDir/about.html
pages/dist/staticDir/bundle2.js
pages/dist/staticDir/style.css
// Bundles for server-side rendering
pages/dist/nodejs/Product.page.template.html
pages/dist/nodejs/Product.page.js
What's crucial here is that:
Some .html files are rendered at build-time and need to be saved in pages/dist/staticDir.
Some other HTML are rendered at request-time and the .html template need to be saved in a separate directory, e.g. pages/dist/nodejs/Product.page.template.html.
The directory pages/dist/staticDir contains all browser-side assets and needs to be served by the server.
Note that pages/dist/staticDir/about.html is fully rendered:
<html><divid='react-root'>
This is the content of an about page.
I'm rendered at build-time!.
</div></html>
Whereas pages/dist/nodejs/Product.page.template.html is only partly rendered:
At request-time, the Node.js server renders Product.page.js to HTML and replaces !PAGE_VIEW_HTML with the rendered HTML.
The practice to render some pages to HTML at build-time while other pages are rendered to HTML at request-time is a common practice in the SSR world. E.g. Next.js does that.
How can I achieve this with Parcel v2?
The text was updated successfully, but these errors were encountered:
In the context of SSR and SR (Static Rendering), I need bundles to be saved as follows.
What's crucial here is that:
.html
files are rendered at build-time and need to be saved inpages/dist/staticDir
..html
template need to be saved in a separate directory, e.g.pages/dist/nodejs/Product.page.template.html
.The directory
pages/dist/staticDir
contains all browser-side assets and needs to be served by the server.Note that
pages/dist/staticDir/about.html
is fully rendered:Whereas
pages/dist/nodejs/Product.page.template.html
is only partly rendered:At request-time, the Node.js server renders
Product.page.js
to HTML and replaces!PAGE_VIEW_HTML
with the rendered HTML.The practice to render some pages to HTML at build-time while other pages are rendered to HTML at request-time is a common practice in the SSR world. E.g. Next.js does that.
How can I achieve this with Parcel v2?
The text was updated successfully, but these errors were encountered: