module-federation-examples
module-federation-examples copied to clipboard
NEXT_PRIVATE_LOCAL_WEBPACK
This is my package.json
{ "name": "remote", "version": "0.1.0", "private": true, "scripts": { "dev": "NEXT_PRIVATE_LOCAL_WEBPACK=true && next dev", "build": "NEXT_PRIVATE_LOCAL_WEBPACK=true && next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@module-federation/nextjs-mf": "^8.1.7", "next": "14.1.0", "react": "^18", "react-dom": "^18" }, "resolutions": { "webpack": "5.1.3" }, "devDependencies": { "eslint": "^8", "eslint-config-next": "14.1.0" } }
I am facing this error
▲ Next.js 14.1.0
- Local: http://localhost:3000
Error: process.env.NEXT_PRIVATE_LOCAL_WEBPACK is not set to true, please set it to true, and "npm install webpack" at NextFederationPlugin.validateOptions
@parag3638 , Remove the NEXT_PRIVATE_LOCAL_WEBPACK = true from the dev and build scripts in the package.json file. Instead, create a .env file and add the NEXT_PRIVATE_LOCAL_WEBPACK = true
@sathishkumar555 It worked but now I am stuck with this....
Error: Cannot find module 'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\next\dist\compiled\lib\util\makeSerializable' Require stack:
- C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules@module-federation\enhanced\dist\src\lib\container\ContainerExposedDependency.js
- C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules@module-federation\enhanced\dist\src\lib\container\ContainerEntryModule.js
- C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules@module-federation\enhanced\dist\src\lib\container\HoistContainerReferencesPlugin.js
- C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules@module-federation\enhanced\dist\src\wrapper\HoistContainerReferencesPlugin.js
- C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules@module-federation\enhanced\dist\src\index.js
- C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules@module-federation\nextjs-mf\dist\src\internal.js
- C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules@module-federation\nextjs-mf\dist\src\plugins\NextFederationPlugin\next-fragments.js
- C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules@module-federation\nextjs-mf\dist\src\plugins\NextFederationPlugin\index.js
- C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules@module-federation\nextjs-mf\dist\src\index.js
- C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\next.config.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\next\dist\server\require-hook.js:55:36
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at mod.require (C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\next\dist\server\require-hook.js:65:28)
at require (node:internal/modules/helpers:176:18)
at Object.
(C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules@module-federation\enhanced\dist\src\lib\container\ContainerExposedDependency.js:8:26) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\@module-federation\enhanced\dist\src\lib\container\ContainerExposedDependency.js', 'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\@module-federation\enhanced\dist\src\lib\container\ContainerEntryModule.js', 'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\@module-federation\enhanced\dist\src\lib\container\HoistContainerReferencesPlugin.js',
'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\@module-federation\enhanced\dist\src\wrapper\HoistContainerReferencesPlugin.js', 'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\@module-federation\enhanced\dist\src\index.js', 'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\@module-federation\nextjs-mf\dist\src\internal.js', 'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\@module-federation\nextjs-mf\dist\src\plugins\NextFederationPlugin\next-fragments.js',
'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\@module-federation\nextjs-mf\dist\src\plugins\NextFederationPlugin\index.js', 'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\node_modules\@module-federation\nextjs-mf\dist\src\index.js', 'C:\Users\H532304.GLOBAL\Desktop\ABC\test\remote\next.config.js' ] }
@parag3638 , I am also getting the same error. Please check this issue #3621
Same error with next v14. Help!
put it in both .env and on the command line.
https://github.com/vercel/next.js/blob/135642b9df800433b42876f777f486aa3b610b93/packages/next/src/compiled/webpack/webpack.js#L6
Otherwise file git issue with vercel.
put it in both .env and on the command line.
https://github.com/vercel/next.js/blob/135642b9df800433b42876f777f486aa3b610b93/packages/next/src/compiled/webpack/webpack.js#L6
Otherwise file git issue with vercel.
where should i add this in next.js there is no such file cale called webpack.js
NEXT_PRIVATE_LOCAL_WEBPACK=true next dev
error still showing
NEXT_PRIVATE_LOCAL_WEBPACK=true next dev
I have the same problem, I comment what I have done to see if they can help me.
Create both Home and Reomte project with NextJS 14 + Typescript + App Router (/src/app/page.tsx)
I made the configuration indicated in this article: https://medium.com/@sarathdixit29/implementing-module-federation-in-next-js-with-typescript-and-eslint-ba6627a0686f
If I run it like this: npm run dev it gives me the same error as the friend who started this thread.
If I change the next.config.mjs file and pass it to anext.config.js and adjust the content as the article says and execute it and now I get this error:
npm run dev
[email protected] dev next dev -p 3001
(node:25736) [DEP0040] DeprecationWarning: The punycode
module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ...
to show where the warning was created)
▲Next.js 14.2.3
- Local: http://localhost:3001
- Environments: .env
✓ Starting...
(node:8476) [DEP0040] DeprecationWarning: The punycode
module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ...
to show where the warning was created)
Error: App Directory is not supported by nextjs-mf. Use only pages directory, do not open git issues about this
at NextFederationPlugin.validateOptions (D:\Dev\workspace\ws-mentor-it\nextjs\module-federation\remote-app\node_modules@module-federation\nextjs-mf\dist\src\plugins\NextFederationPlugin\index.js :67:23)
at NextFederationPlugin.apply (D:\Dev\workspace\ws-mentor-it\nextjs\module-federation\remote-app\node_modules@module-federation\nextjs-mf\dist\src\plugins\NextFederationPlugin\index.js :45:19)
at createCompiler (D:\Dev\workspace\ws-mentor-it\nextjs\module-federation\remote-app\node_modules\next\dist\compiled\webpack\bundle5.js:28:1467450)
at D:\Dev\workspace\ws-mentor-it\nextjs\module-federation\remote-app\node_modules\next\dist\compiled\webpack\bundle5.js:28:1467068
at Array.map (
How do I make it not look in the "pages" folder but instead look for them in src/app/page.tsx?
Delete the app folder and only use pages.