rstack-examples icon indicating copy to clipboard operation
rstack-examples copied to clipboard

module-federation-interop does not run

Open foxaltus opened this issue 1 year ago • 1 comments

The webpack-mf project inside module-federation-interop on the main branch does not run.

Here is the error:

PS C:\...\rspack-examples\rspack\module-federation-interop\webpack-mf> pnpm dev

> [email protected] dev C:\...\rspack-examples\rspack\module-federation-interop\webpack-mf
> webpack serve

[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
 - options has an unknown property '_assetEmittingPreviousFiles'. These properties are valid:
   object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, ipc?, liveReload?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }
 ELIFECYCLE  Command failed with exit code 2.

foxaltus avatar Jan 17 '25 10:01 foxaltus

Looks like you need to update webpack-cli to a more recent version (see https://github.com/webpack/webpack-cli/issues/2894#issuecomment-2251131291).

This did the trick in webpack-mf/package.json :

-    "webpack-cli": "4.10.0"
+    "webpack-cli": "5.1.4"

Also don't forget set the mode in webpack.config.js:

module.exports = {
+  mode: isProduction ? "production" : "development",
  entry: "./src/index.js",

foxaltus avatar Jan 17 '25 10:01 foxaltus