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.

Is there no more correct solution for next.js with ssr?

See original GitHub issue

Is there no hack-free solution https://github.com/module-federation/module-federation-examples/blob/master/nextjs-ssr/host/next.config.js

        remoteLib: isServer
          ? "remoteLib@http://localhost:3002/node/remoteEntry.js"
          : //This is a hack (I cannot run successfully MF in client-side with NextJS and React, maybe doing smth wrong)
            {
              external: `external new Promise((r, j) => {
              window['remoteLib'].init({
                react: {
                  "${packageJsonDeps.react}": {
                    get: () => Promise.resolve().then(() => () => globalThis.React),
                  }
                }
              });
              r({
                get: (request) => window['remoteLib'].get(request),
                init: (args) => {}
              });
            })`,
            },
        // : "remoteLib@http://localhost:3001/remoteEntry.js",
      },```

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
ScriptedAlchemycommented, Jan 13, 2022

Close to releasing SSR support as a plugin for next. Already in production and should go into open beta soon

1reaction
ScriptedAlchemycommented, Jun 28, 2022

Yeah the core code has changed quite a bit and I’ve been focusing on internal app upgrades. im refreshing the implementation now to bring everything back up. It’s several releases behind right now, but I’ve got it up locally again so likely just need to redeploy the apps with the new plugin code

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Disable Server-Side Rendering (SSR) in Next.js
Step 1: Rewrite All Requests to pages/index.js · Step 2: Disable SSR for Page Content · Step 3: Check that Everything Works 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 >
Hey Next.js, Is Server Side Rendering Dead?
Next.js is not the first solution to introduce SSR with React, but it shows an excellent way to fetch data(AKA: getInitialProps).
Read more >
Next.js No longer use SSR/SSG functions - YouTube
Next. js 13 brought a complete redesign to the Data fetching system. No more getServerSideProps or getStaticSideProps and no more separation ...
Read more >
SSR vs SSG in Next.js – a practical overview for CTOs and devs
Next.js pre-renders pages using static generation, which among other things means that it doesn't fetch any data by default. If you need to ......
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