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. NextJS: failure to load in SSR

See original GitHub issue

Describe the bug When using the recently released Beta React SDK with Next.js and Next.js throws and error Server Error SyntaxError: Cannot use import statement outside a module when trying to server-side render the builder RenderContent component.


To Reproduce Stackblitz

Expected behavior We can use the builder SDK with SSR (eventually we will want to use server component with the SDK)

Additional context one workaround to is only render the Builder component on the client.

Thanks for the help! I’m excited to see that the bundle size is only 13 kB. Seems more reasonable.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

charkourcommented, Aug 23, 2022

Thanks @samijaber, that’s looking great!

Thanks for the quick fix.

samijabercommented, Aug 18, 2022

Ah, we need to add type: module to the npm package. Will do that and test it out soon

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next.js SSR pages are failing in production builds · Issue #6736
Building and starting a next.js project that has an SSR page with nx build is giving Internal Server Error , but not with...
Read more >
react-hydration-error - Next.js
When css-in-js libraries are not set up for pre-rendering (SSR/SSG) it will often lead to a hydration mismatch. In general this means the...
Read more >
Next js app with SSR is not pre-rendering HTML, so web ...
Within the auth context file, I was performing conditional rendering, depending on a loading state, which was causing SSR not to take place:....
Read more >
Implementing SSR in Next.js: Dynamic routing and prefetching
This happens because named, or static, routes have a higher priority than a dynamic route. For example, if you have declared a dynamic...
Read more >
How to disable Server-Side Rendering in Next.js
There are some instances where you don't need SSR for your Next.js components. In this article, we'll go over how you can disable...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found