IE的角度构建生产

时间:2017-08-31 07:26:59

标签: angular internet-explorer

您好我的Internet Explorer有问题。当我使用npm start运行应用程序时,它可以在Internet Explorer中打开。但是当我在IE中构建生产(ng build --prod)时,我看不到我的应用程序,只有白屏。 的的package.json:

 {
  "name": "app-name",
  "version": "0.0.7",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "prebuild": "npm version patch",
    "build": "ng build --prod --base-href=./",
    "build_dev": "ng build",
    "postbuild": "xcopy /y package.json dist && xcopy /y web.config dist && xcopy /y dist \\\\Server\\App",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "@types/jquery": "^2.0.45",
    "angular2-flash-messages": "^1.0.8",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "jquery": "^3.2.1",
    "jquery-validation": "^1.16.0",
    "ng-sidebar": "^5.0.1",
    "ng2-completer": "^1.4.0",
    "ng2-popover": "0.0.14",
    "ng2-select": "^1.2.0",
    "ng2-slim-loading-bar": "^4.0.0",
    "ngx-popover": "0.0.16",
    "node-require": "0.0.10",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.0.4",
    "@angular/compiler-cli": "^4.0.0",
    "@types/core-js": "^0.9.41",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0"
  }
}

角-cli.json

    {
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "app-name"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "img",
        "web.config"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "../node_modules/bootstrap/dist/css/bootstrap.min.css",
        "../node_modules/font-awesome/css/font-awesome.min.css",
        "../node_modules/font-awesome/fonts/fontawesome-webfont.woff",
        "../node_modules/font-awesome/fonts/fontawesome-webfont.woff2",
        "./css/layout_style/style.min.css",
        "./css/layout_style/skins.css",
        "./css/layout_style/custom_style.css",
        "./css/style.css"
      ],
      "scripts": [
        "../node_modules/jquery/dist/jquery.min.js",
        "./scripts/modernizr-2.8.3.js",
        "../node_modules/jquery-validation/dist/jquery.validate.min.js",
        "../node_modules/bootstrap/dist/js/bootstrap.min.js",
        "./scripts/respond.min.js",
        "./scripts/custom_app.js",
      ],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json"
    },
    {
      "project": "src/tsconfig.spec.json"
    },
    {
      "project": "e2e/tsconfig.e2e.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}

在polyfills.ty中我取消注释:

    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/set';

问题出在哪里?感谢建议

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,只需将本地angular-cli版本更新为最新版本(日期为6.0.7)即可使用