module-federation throws "has not been built from source" or "dispatcher.getOwner is not a function" #33501
Unanswered
luckyluggi
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have set up an nx monorepo that has 1 host, 2 remotes and 3 libs that reference each other.
While these are quite some projects for an mvp i still consider is a basic setup.
When serving a remote i get this error:
src/app/app.tsx(7,16): error TS6305: Output file 'C:/dev/_try/org/apps/remotes/shop/dist/remote-entry.d.ts' has not been built from source file 'C:/dev/_try/org/apps/remotes/shop/src/remote-entry.ts'.
src/app/app.tsx(10,16): error TS6305: Output file 'C:/dev/_try/org/apps/remotes/todo/dist/remote-entry.d.ts' has not been built from source file 'C:/dev/_try/org/apps/remotes/todo/src/remote-entry.ts'.
When i add the remotes to the remotes array in the hosts module-federation.config.ts i can serve the remote but then i get:
ERROR
dispatcher.getOwner is not a function
TypeError: dispatcher.getOwner is not a function
at getOwner (http://localhost:4200/main.js:11061:54)
at webpack_modules.../../../node_modules/.pnpm/[email protected]/node_modules/react/cjs/react.development.js.exports.createElement (http://localhost:4200/main.js:11950:9)
at BrowserRouter (http://localhost:4200/main.js:8512:58)
at l5 (http://localhost:4202/397.08e15caa8092baa2.js:1:51100)
at o_ (http://localhost:4202/397.08e15caa8092baa2.js:1:71494)
at oq (http://localhost:4202/397.08e15caa8092baa2.js:1:82524)
at iw (http://localhost:4202/397.08e15caa8092baa2.js:1:116157)
at http://localhost:4202/397.08e15caa8092baa2.js:1:116002
at ik (http://localhost:4202/397.08e15caa8092baa2.js:1:116010)
at ii (http://localhost:4202/397.08e15caa8092baa2.js:1:112166)
You can check out the demo project from here:
https://github.com/luckyluggi/nx-mf-has-not-been-built-from-source
I have documented every step and information in the readme.
I did already ask this in the discord forum but didnt get an answer there. So i hope someone might see it here.
I'd really appreciate any help because i cant figure it his out on my own. I think i followed the steps described in nx docs and used the generators as intended. I might just have made a stupid little mistake in the setup. Please can someone help solve this me. 🥴
Beta Was this translation helpful? Give feedback.
All reactions