Giter Club home page Giter Club logo

Comments (15)

gitneeraj avatar gitneeraj commented on July 26, 2024 2

@yululu1234 not sure if I can understand your issue fully but I can relate it to mine which I got it working some days back. Please check https://github.com/gitneeraj/nextjs-mf-host/blob/main/pages/%5B...slug%5D.js if it helps at all.
Here the slug page dynamically loads the federated page and executes its GSSP.

from universe.

alibek-gao avatar alibek-gao commented on July 26, 2024 2

@gitneeraj yes, it works, but it has a room for improvement

from universe.

ScriptedAlchemy avatar ScriptedAlchemy commented on July 26, 2024

Open a PR, I'd gladly take in a utility export in my next plugin.

from universe.

alibek-gao avatar alibek-gao commented on July 26, 2024

@gitneeraj does your solution render on server side?

from universe.

gitneeraj avatar gitneeraj commented on July 26, 2024

@alibek-gao Honestly I haven't checked for SSR with my above approach(as am occupied with another project) and I don't think it would work as I get the module client side.

I also noticed you linked a beta PR, curious to know if that solves the SSR as well?

from universe.

gitneeraj avatar gitneeraj commented on July 26, 2024

@alibek-gao May I know why your PR was closed? Any critical issue?

from universe.

alibek-gao avatar alibek-gao commented on July 26, 2024

@gitneeraj I removed PathToRemoteMap data structure, because it adds unnecessary complexity and the possibility of memory leaks.

from universe.

gitneeraj avatar gitneeraj commented on July 26, 2024

@alibek-gao I pulled in your latest from the beta PR branch and it throws this error
dynamicFedError

I guess the pathResolver should return the remote and the module path( Eg: remoteApp & ./pages/contact) at this line
https://github.com/module-federation/universe/pull/839/files#diff-8e23c4736059c81a4d63b1c6db4a1555d7249da5ddc4d3321de605ff6a80c9a9R65

from universe.

alibek-gao avatar alibek-gao commented on July 26, 2024

current version of nextjs-mf has import issue with injectScript
I did not find solution, only workaround:
https://github.com/module-federation/universe/blob/3f951cdb7b9b934c3ce756d0df703a2d444a4140/apps/3000-home/pages/%5B...slug%5D.js

from universe.

gitneeraj avatar gitneeraj commented on July 26, 2024

@alibek-gao replacing pathResolver with matchFederatedPage works well as it returns the correct remote and module path. defaultPathResolver returns the incorrect values for me to be used in injectScript. Was this tried before?
Here is the working SSR repo https://github.com/gitneeraj/nextjs-mf-host/blob/main/pages/%5B...slug%5D.js#L14

from universe.

alibek-gao avatar alibek-gao commented on July 26, 2024

@gitneeraj could you give me an example

defaultPathResolver getMatchedPage
path remoteContainer modulePath remoteContainer modulePath
.. .. .. .. ..

from universe.

gitneeraj avatar gitneeraj commented on July 26, 2024

@alibek-gao
Path: /contact

defaultPathResolver

  • remoteContainer: contact
  • modulePath: ./index

getMatchedPage

  • remoteContainer: remote1
  • modulePath: ./pages/contact

from universe.

alibek-gao avatar alibek-gao commented on July 26, 2024

it works as intended

defaultPathResolver works this way

path === `/${remoteContainer}${modulePath}`

anyone can make custom pathResolver

from universe.

ScriptedAlchemy avatar ScriptedAlchemy commented on July 26, 2024

I apologize for the confusion, but I'd like to clarify a few things. Are you experiencing problems with version 6 but not with version 7, or is it the other way around?

Given that version 7 is a substantial overhaul, I'm particularly interested in knowing whether the beta versions have brought about any improvements or introduced any issues.

from universe.

github-actions avatar github-actions commented on July 26, 2024

Stale issue message

from universe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.