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.

SSR component from package

See original GitHub issue

I’m having trouble server-side-rendering a component directly from a package. I can load the component in the client like so:

react_component('@package/package-name.ComponentName')

But I can require('@package/package-name').ComponentName fine, but when trying to SSR, i get an error that it is undefined.

Do I have to explicitly make this package available for SSR somehow?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
quinncommented, Sep 9, 2019

wouldn’t I have to

window.PackageComponent = require('@package/package-name').ComponentName

explicitly?

Either way, I will try it out and let you know how it goes. thank you!

0reactions
alkesh26commented, Nov 7, 2022

@quinn, closing the issue for now. We have a solution for this, as discussed in the above conversations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Server Components. - It's not server-side rendering.
SSR as how it works today in React applications is simply sending components rendered as HTML into the client so that your app...
Read more >
@times-components/ssr - npm
SSR. The renderer used to render top level components server side and to create client bundles. Add any "pages" (top level components) here ......
Read more >
A beginner's guide to React Server-Side Rendering (SSR)
In this lesson, we are going to talk about server-side rendering (SSR), its benefits, and its pitfalls. Then we will set up a...
Read more >
Server Side Rendering - Loadable Components
Loadable components loads all your scripts asynchronously to ensure optimal performances. ... Disable SSR on a specific loadable component with ssr: false :....
Read more >
How to use client-side only packages with SSR in Gatsby and ...
To try this, just spin up a Next.js project and import the Map component together with its wrapper into a server-side generated page....
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