加载到Angular 6 [WDS]后,在IE上断开连接

时间:2018-07-02 13:36:35

标签: angular angular-cli internet-explorer-11 webpack-dev-server angular6

我将Angular Project从5更新到了6。但是现在我的Internet Explorer 11出现了问题。每次尝试在localhost:4200上加载实时开发服务器时,都会显示登录页面,但立即与实时开发服务器断开连接

the error on IE console

所有其他浏览器都可以正常工作,在控制台上没有错误(尝试使用Edge,Firefox和Chrome)

我的填埋场看起来像这样:

/**
 * This file includes polyfills needed by Angular and is loaded before the app.
 * You can add your own extra polyfills to this file.
 *
 * This file is divided into 2 sections:
 *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
 *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
 *      file.
 *
 * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
 * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
 * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
 *
 * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
 */

/***************************************************************************************************
 * BROWSER POLYFILLS
 */

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
import 'classlist.js';  // Run `npm install --save classlist.js`.

/** IE10 and IE11 requires the following for the Reflect API. */
import 'core-js/es6/reflect';


/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';


/**
 * Required to support Web Animations `@angular/platform-browser/animations`.
 * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
 **/
import 'web-animations-js';  // Run `npm install --save web-animations-js`.

/**
 * By default, zone.js will patch all possible macroTask and DomEvents
 * user can disable parts of macroTask/DomEvents patch by setting following flags
 */

// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames

/*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*/
// (window as any).__Zone_enable_cross_context_check = true;

/***************************************************************************************************
 * Zone JS is required by default for Angular itself.
 */
import 'zone.js/dist/zone';  // Included with Angular CLI.



/***************************************************************************************************
 * APPLICATION IMPORTS
 */

和我的package.json

{
  "name": "kwm",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.0.7",
    "@angular/cdk": "^6.3.1",
    "@angular/common": "^6.0.7",
    "@angular/compiler": "^6.0.7",
    "@angular/core": "^6.0.7",
    "@angular/forms": "^6.0.7",
    "@angular/http": "^6.0.7",
    "@angular/material": "^6.3.1",
    "@angular/platform-browser": "^6.0.7",
    "@angular/platform-browser-dynamic": "^6.0.7",
    "@angular/router": "^6.0.7",
    "@ngx-translate/core": "^10.0.2",
    "@ngx-translate/http-loader": "^3.0.1",
    "@swimlane/ngx-charts": "^8.1.0",
    "@swimlane/ngx-datatable": "^13.0.1",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.7",
    "hammerjs": "^2.0.8",
    "intl": "^1.2.5",
    "jquery": "^3.3.1",
    "moment": "^2.22.2",
    "ng2-completer": "^2.0.8",
    "ng2-semantic-ui": "^0.9.7",
    "ng4-click-outside": "^1.0.1",
    "ngx-bootstrap": "^3.0.1",
    "ngx-file-drop": "^4.0.6",
    "ngx-perfect-scrollbar": "^6.2.0",
    "ngx-popover": "^0.0.16",
    "rxjs": "^6.2.1",
    "rxjs-compat": "^6.2.1",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/cli": "~6.0.8",
    "@angular/compiler-cli": "^6.0.7",
    "@angular/language-service": "^6.0.7",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~10.5.1",
    "angular-2-dropdown-multiselect": "^1.8.0",
    "codelyzer": "^4.4.2",
    "jasmine-core": "~3.1.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.4",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^1.2.0",
    "protractor": "~5.3.2",
    "ts-node": "~7.0.0",
    "tslint": "~5.10.0",
    "typescript": "~2.7.2",
    "@angular-devkit/build-angular": "~0.6.8"
  }
}

我已经删除了package_lock.json的node_modules文件夹,并重新安装了 npm

2 个答案:

答案 0 :(得分:1)

您错过了一条仍需要取消注释的评论:

/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';

答案 1 :(得分:0)

我实际上是在尝试重现此问题时,通过从index.html中删除未使用的脚本来修复它的。直到我升级到Angular 6之前一切都还好,才知道是什么真正导致了问题的发生。