Webpack热中间件问题:已创建具有不同配置的平台。请先破坏它

时间:2018-04-18 12:41:10

标签: asp.net-mvc angular webpack webpack-dev-server

我创建了ASP .NET Core 2解决方案并将其升级到Angular 5.2.10,现在当我运行我的应用程序时,没有发生热模块更换并发出此错误:

Error: A platform with a different configuration has been created.
Please destroy it first.

package.json

{
  "name": "Project",
  "private": true,
  "version": "0.0.0",
  "scripts": {
    "test": "karma start ClientApp/test/karma.conf.js"
  },
  "devDependencies": {
    "@angular/animations": "5.2.10",
    "@angular/cli": "^1.7.4",
    "@angular/common": "5.2.10",
    "@angular/compiler": "5.2.10",
    "@angular/compiler-cli": "5.2.10",
    "@angular/core": "5.2.10",
    "@angular/forms": "5.2.10",
    "@angular/http": "5.2.10",
    "@angular/platform-browser": "5.2.10",
    "@angular/platform-browser-dynamic": "5.2.10",
    "@angular/platform-server": "5.2.10",
    "@angular/router": "5.2.10",
    "@ngtools/webpack": "6.0.0-rc.5",
    "@types/chai": "4.1.2",
    "@types/jasmine": "2.8.6",
    "@types/react": "^16.3.11",
    "@types/webpack-env": "1.13.6",
    "angular2-router-loader": "0.3.5",
    "angular2-template-loader": "0.6.2",
    "aspnet-prerendering": "^3.0.1",
    "aspnet-webpack": "^2.0.1",
    "awesome-typescript-loader": "5.0.0",
    "bootstrap": "4.1.0",
    "chai": "4.1.2",
    "css": "2.2.1",
    "css-loader": "^0.28.11",
    "es6-shim": "0.35.3",
    "event-source-polyfill": "0.0.12",
    "expose-loader": "0.7.5",
    "extract-text-webpack-plugin": "3.0.2",
    "file-loader": "1.1.11",
    "html-loader": "0.5.5",
    "isomorphic-fetch": "2.2.1",
    "jasmine-core": "3.1.0",
    "jquery": "3.3.1",
    "json-loader": "0.5.7",
    "karma": "2.0.0",
    "karma-chai": "0.1.0",
    "karma-chrome-launcher": "2.2.0",
    "karma-cli": "1.0.1",
    "karma-jasmine": "1.1.1",
    "karma-webpack": "3.0.0",
    "ng2-react": "^0.2.1",
    "node-sass": "^4.8.3",
    "office-ui-fabric-react": "^5.80.0",
    "preboot": "6.0.0-beta.3",
    "raw-loader": "0.5.1",
    "react": "^16.3.1",
    "react-dom": "^16.3.1",
    "reflect-metadata": "0.1.12",
    "rxjs": "5.5.10",
    "sass-loader": "^7.0.1",
    "style-loader": "^0.20.3",
    "to-string-loader": "1.1.5",
    "typescript": "2.8.1",
    "url-loader": "1.0.1",
    "webpack": "4.6.0",
    "webpack-dev-server": "3.1.0",
    "webpack-hot-middleware": "2.21.0",
    "webpack-merge": "4.1.2",
    "zone.js": "0.8.12"
  },
  "dependencies": {
    "angular2-react": "0.0.1",
    "popper.js": "^1.14.3"
  }
}

tsconfig.json

{
  "atom": { "rewriteTsconfig": false },
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es6", "dom" ],
    "module": "es2015",
    "moduleResolution": "node",
    "noImplicitAny": false,
    "skipDefaultLibCheck": true,
    "skipLibCheck": true,
    "sourceMap": true,
    "target": "es5",
    "types": [ "webpack-env" ]
  },
  "exclude": [ "bin", "node_modules" ]
}

1 个答案:

答案 0 :(得分:0)

发现问题是web-pack中的版本冲突不得不将webpack-hot-middleware降级到2.20.0。