无法在单 SPA 应用程序中启动微前端应用程序

Sai*_*lan 5 npm webpack webpack-dev-server single-spa

我在尝试在 Single-SPA 应用程序中启动子应用程序时遇到错误。基本上,我正在尝试开发一种 util 应用程序(Single-SPA 中的子应用程序),其中包含 Sockjs、Stomp-client 等。我删除了节点模块和 package-lock.json 并再次安装了节点模块。当我尝试启动应用程序时,我遇到以下错误。

Error:
[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 'firewall'. These properties are valid:
   object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, setupExitSignals?, static?, watchFiles?, webSocketServer? }
 - options.client has an unknown property 'host'. These properties are valid:
   object { logging?, overlay?, progress?, webSocketTransport?, webSocketURL? }
Run Code Online (Sandbox Code Playgroud)

用于运行应用程序的命令:npm start

包.json

Error:
[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 'firewall'. These properties are valid:
   object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, setupExitSignals?, static?, watchFiles?, webSocketServer? }
 - options.client has an unknown property 'host'. These properties are valid:
   object { logging?, overlay?, progress?, webSocketTransport?, webSocketURL? }
Run Code Online (Sandbox Code Playgroud)

Som*_*pub 12

我通过将“webpack-config-single-spa-ts”从 2.0.0 更新到 3.0.0 解决了这个问题。


Ste*_*ant 6

从webpack-dev-server v4.0.0-rc.0开始,该firewall选项已被重命名

您应该使用allowedHosts而不是firewall.

此问题已在webpack-config-single-spa 版本 4.0.0 中修复,因此升级此包也将解决您的问题。