应用程序中启动微前端应用程序

应用程序中启动微前端应用程序

本文介绍了无法在单 SPA 应用程序中启动微前端应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am facing error while trying to start sub-app in Single-SPA application. Basically, I am trying to develop a kind of util app (sub app in Single-SPA) which contains Sockjs, Stomp-client etc. I have removed node modules and package-lock.json and installed node modules again. When I try to start application I am facing below error.

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? }

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

Command used for running the app : npm start

package.json

{
  "name": "@sudeep/livedoc",
  "scripts": {
    "start": "webpack serve",
    "start:standalone": "webpack serve --env standalone",
    "build": "webpack --mode=production",
    "analyze": "webpack --mode=production --env analyze",
    "lint": "eslint src --ext js,ts,tsx",
    "format": "prettier --write .",
    "check-format": "prettier --check .",
    "prepare": "husky install",
    "test": "cross-env BABEL_ENV=test jest --passWithNoTests",
    "watch-tests": "cross-env BABEL_ENV=test jest --watch",
    "coverage": "cross-env BABEL_ENV=test jest --coverage"
  },
  "devDependencies": {
    "@babel/core": "^7.14.6",
    "@babel/eslint-parser": "^7.14.7",
    "@babel/plugin-transform-runtime": "^7.14.5",
    "@babel/preset-env": "^7.14.7",
    "@babel/preset-typescript": "^7.14.5",
    "@babel/runtime": "^7.14.6",
    "babel-jest": "^27.0.5",
    "concurrently": "^6.2.0",
    "cross-env": "^7.0.3",
    "eslint": "^7.29.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-config-ts-important-stuff": "^1.1.0",
    "eslint-plugin-prettier": "^3.4.0",
    "husky": "^6.0.0",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^27.0.5",
    "jest-cli": "^27.0.5",
    "prettier": "^2.3.2",
    "pretty-quick": "^3.1.1",
    "ts-config-single-spa": "^2.0.1",
    "typescript": "^4.3.4",
    "webpack": "^5.40.0",
    "webpack-cli": "^4.7.2",
    "webpack-config-single-spa": "^4.0.0",
    "webpack-config-single-spa-ts": "^2.2.2",
    "webpack-dev-server": "^3.11.2",
    "webpack-merge": "^5.8.0"
  },
  "dependencies": {
    "@types/jest": "^26.0.23",
    "@types/systemjs": "^6.1.0",
    "@types/webpack-env": "^1.16.0",
    "fast-json-patch": "3.0.0-1",
    "rxjs": "6.6.0",
    "stompjs": "2.3.3",
    "sockjs-client": "1.5.0"
  }
}

推荐答案

我通过更新webpack-config-single-spa-ts"解决了这个问题从 2.0.0 到 3.0.0.

I resolved this problem by updating "webpack-config-single-spa-ts" from 2.0.0 to 3.0.0.

这篇关于无法在单 SPA 应用程序中启动微前端应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 18:46