Comments (15)
@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.
@gitneeraj yes, it works, but it has a room for improvement
from universe.
Open a PR, I'd gladly take in a utility export in my next plugin.
from universe.
@gitneeraj does your solution render on server side?
from universe.
@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.
@alibek-gao May I know why your PR was closed? Any critical issue?
from universe.
@gitneeraj I removed PathToRemoteMap
data structure, because it adds unnecessary complexity and the possibility of memory leaks.
from universe.
@alibek-gao I pulled in your latest from the beta PR branch and it throws this error
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.
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.
@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.
@gitneeraj could you give me an example
defaultPathResolver | getMatchedPage | |||
---|---|---|---|---|
path | remoteContainer | modulePath | remoteContainer | modulePath |
.. | .. | .. | .. | .. |
from universe.
@alibek-gao
Path: /contact
defaultPathResolver
- remoteContainer:
contact
- modulePath:
./index
getMatchedPage
- remoteContainer:
remote1
- modulePath:
./pages/contact
from universe.
it works as intended
defaultPathResolver
works this way
path === `/${remoteContainer}${modulePath}`
anyone can make custom pathResolver
from universe.
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.
Stale issue message
from universe.
Related Issues (20)
- Enhance type capabilities HOT 4
- Version 8.2.0 makeSeriazable bug with NextJS 14.0.4 HOT 1
- @module-federation/nextjs-mf doen't seem to work with App Router HOT 1
- Getting error [FederatedTypesPlugin] Unable to download 'remote-app' remote types index file: Request failed with status code 404 HOT 10
- Incompatible with web worker HOT 4
- TypeError: (0, react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__jsxDEV) is not a function HOT 7
- TypeError: Cannot read properties of undefined (reading '_config') HOT 19
- `@module-federation/typescript` is broken in esm contexts HOT 6
- nextjs-mf 7 to 8 migration HOT 11
- Next page router host with React remote - React is undefined HOT 7
- New version of module federation doc HOT 5
- [nextjs] v8.2.4 caches remoteEntry.js leading to stale chunks. remoteEntry is missing the ?t={date.now()} timestamp. HOT 11
- init (from @module-federation/runtime) doesn't support registering multiple versions of the same shared module HOT 7
- Register dynamic remote not working with NextJS MF HOT 1
- Critical dependency: the request of a dependency is an expression HOT 4
- NextJS MF gives error when deployed on Vercel but works fine locally HOT 1
- The loadShareSync function was unable to load react. The react could not be found in federation_provider. HOT 13
- minor: odd copy in plugin / hooks documentation HOT 1
- Resolve @mf-types.zip from remote adress if public path is relative HOT 4
- [nextjs-mf] Manifest is not being generated for the client HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from universe.