core: [Nextjs plugin] Error: Shared module next/router doesn't exist in shared scope default
Getting this error when trying to use the NextJs(13.5.1, 13.5.2) pages router with @module-federation/nextjs-mf
Error: Shared module next/router doesn't exist in shared scope default
at w (/Users/test/Projects/tom-fe-core/apps/template-host/.next/server/webpack-runtime.js:1:11882)
at /Users/test/Projects/tom-fe-core/apps/template-host/.next/server/webpack-runtime.js:1:12360
at /Users/test/Projects/tom-fe-core/apps/template-host/.next/server/webpack-runtime.js:1:12295
at 1819 (/Users/test/Projects/tom-fe-core/apps/template-host/.next/server/webpack-runtime.js:1:12682)
at /Users/test/Projects/tom-fe-core/apps/template-host/.next/server/webpack-runtime.js:1:13759
at Array.forEach (<anonymous>)
at __webpack_require__.getEagerSharedForChunkId (/Users/test/Projects/tom-fe-core/apps/template-host/.next/server/webpack-runtime.js:1:13157)
at /Users/test/Projects/tom-fe-core/apps/template-host/.next/server/pages/index.js:8:7788
at Object.<anonymous> (/Users/test/Projects/tom-fe-core/apps/template-host/.next/server/pages/index.js:8:8077)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
This issue does not seem to appear in NextJS version 13.4.19 or below.
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Reactions: 2
- Comments: 15 (6 by maintainers)
stay on older version for now
#1268 this should fix it, but its still undergoing testing and ive not yet pushed a prerelease to npm.
@akifunal, Please share the following package in the shared scope of your next.config.js or next.config.ts file like this:
Never mind, had accidentally removed NEXT_PRIVATE_LOCAL_WEBPACK=1 from .env in my scrambling around.
@ScriptedAlchemy, thank you for your hard work. The only problem is that I’m encountering webpack errors when building. I’ve created a CodeSandbox for it.nextjs13-nextjs-mf
The error looks like this;
Yep, patched and shipped in today already for runtime chunk handlers.
You can try
next
tag on npm now, it should be better prerelease