Angular 6在IE11中不起作用并抛出SCRIPT1002:语法错误vendor.js

时间:2019-01-06 12:21:41

标签: angular angular6

我正在使用.netCore webapi应用程序运行Angular 6,并尝试将其加载到IE11中 并抛出错误: “ SCRIPT1002:语法错误” “ vendor.js”

并显示空白页。

在镀铬和边缘中效果很好

我已经尝试取消对polyfill的注释,寻找在IE中不能很好构建的程序包,并尝试升级我的cli。 并添加     <meta http-equiv="X-UA-Compatible" content="IE=edge" > 在index.html

这是package.json:

    "name": "stars",
"version": "1.0.0",
"scripts": {
    "start": "node cli dev",
    "dev": "node cli dev",
    "prod": "node cli prod",
    "backend": "node cli runBackend",
    "client": "node cli runClient"
},
"private": true,
"dependencies": {
    "@angular/animations": "^6.1.10",
    "@angular/cdk": "^6.4.7",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/material": "^6.4.7",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "@types/express": "^4.16.0",
    "aos": "^2.3.4",
    "build-utils": "^1.0.120",
    "classlist.js": "^1.1.20150312",
    "colors": "^1.3.1",
    "complog": "2.0.3",
    "compression": "^1.7.3",
    "core-js": "^2.5.4",
    "express": "^4.16.3",
    "express-handlebars": "^3.0.0",
    "hammerjs": "^2.0.8",
    "install": "^0.12.2",
    "into-stream": "^3.1.0",
    "jsonwebtoken": "^8.3.0",
    "ngx-page-scroll": "^5.0.0",
    "nodemon": "^1.18.3",
    "npm": "^6.5.0",
    "object.values": "1.0.4",
    "opener": "^1.4.3",
    "request": "^2.88.0",
    "request-promise-native": "^1.0.5",
    "rxjs": "^6.0.0",
    "rxjs-compat": "^6.2.2",
    "script-loader": "^0.7.2",
    "swiper": "^4.4.2",
    "t-rex": "^2.10.4",
    "web-animations-js": "^2.3.1",
    "winston": "^3.0.0-rc1",
    "zone.js": "~0.8.26"
},
"devDependencies": {
    "@angular-devkit/build-angular": "~0.7.0",
    "@angular/cli": "^7.1.4",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@types/jasmine": "2.8.3",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^10.7.1",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^3.1.4",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.3.0",
    "ts-node": "~5.0.1",
    "tslint": "~5.9.1",
    "typescript": "~2.7.2"
}

我希望该项目将在IE11及更低版本中运行,但实际结果并非如此。

1 个答案:

答案 0 :(得分:0)

发生这种情况是因为刷卡。 swiper.js使用Dom7,而dom 7解决了这个问题 所以喜欢这样使用swiper:

import Swiper from 'swiper'

我这样使用它:

import Swiper from '../../../../node_modules/swiper/dist/js/swiper.js';

我希望它会有所帮助。