question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🙋 feature request: built-in SSR for using bundler middleware

See original GitHub issue
  • Add an ssr option that, when enabled, renders React components into their including .html files, calling getInitialProps({req}) before rendering a la next.js
  • Extend server to call a render method on assets if ssr: true
  • Add a built-in render method to HTMLAsset that traverses linked assets, finds occurrences of ReactDOM.render/createPortal in JS/JSX files, and uses ReactDOMServer to render to a string and replace the contents of the HTML.

See also: #355

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:7
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lbguilhermecommented, Feb 4, 2018

Just would like to add that for SSR to be useful, it is quite complicated. It must:

  • Resolve the route to render the correct component (react-router)
  • Understand how the application store state and transfer that state as well (rehydrate)
  • Wait for APIs/Database calls from the components so that the rendered result actually have some content
  • Do all of that with HMR?

And parcel serve is not a production server in any way, I don’t think it should handle SSR. Maaaybe parcel would output a separated bundle suitable to run on Node that is a server with SSR for that application. But that sounds too much.

1reaction
devongovettcommented, Feb 4, 2018

The problem with this request is that Parcel is not specific to react. So we must design our features in a generic way that considers all possible frameworks.

That being said, if there is a way to have parcel enable this in a generic way so that e.g. plugins could implement SSR for react and other frameworks, that would be awesome. Let’s figure out what that looks like.

Read more comments on GitHub >

github_iconTop Results From Across the Web

📚 API
Middleware can be used to hook into an http server (e.g. express or node http ). An example of using the Parcel middleware...
Read more >
done-ssr-middleware
Express/Connect middleware for DoneJS applications. ... Start using done-ssr-middleware in your project by running `npm i ...
Read more >
A curated list of awesome things related to Vue.js
WebTechSurvey.com - An extensive list of websites created with the Vue.js Javascript ... Feature Requests (Laravel + Vue Combo) by haydenbbickerton ...
Read more >
The Complete Junior to Senior Web Developer Roadmap ...
This course is your step-by-step roadmap to becoming an admired and respected Senior Developer. You'll learn the most in-demand skills and topics that...
Read more >
https://raw.githubusercontent.com/vuejs/awesome-vu...
[vuex-feature-scoped-structure](https://github.com/igeligel/vuex-feature- ... A Vue.js SSR boilerplate with Nuxt, Element (custom theme) and Vue Apollo.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found