简体   繁体   English

Angular 9 未捕获的 ReferenceError: regeneratorRuntime 未定义

[英]Angular 9 Uncaught ReferenceError: regeneratorRuntime is not defined

I created a new angular app, where I imported a 3rd party app (svgedit) by copying all the contents in dist folder into the angular app's assets folder and referenced it in the index.html.我创建了一个新的 angular 应用程序,通过将 dist 文件夹中的所有内容复制到 angular 应用程序的 assets 文件夹中并在 index.ZFC35FDC70D5FC69D273EZ8 中引用它来导入第 3 方应用程序 (svgedit)。 Now i get this error现在我得到这个错误

Uncaught ReferenceError: regeneratorRuntime is not defined未捕获的 ReferenceError:未定义 regeneratorRuntime

I have searched and seen recommendations to include babel-polyfill etc, but haven't been able to solve this.我已经搜索并看到了包含 babel-polyfill 等的建议,但无法解决这个问题。

This is my setup, Angular 9.1.7这是我的设置,Angular 9.1.7

Packages套餐

@angular-devkit/architect         0.901.7
@angular-devkit/build-angular     0.901.7
@angular-devkit/build-optimizer   0.901.7
@angular-devkit/build-webpack     0.901.7 
@angular-devkit/core              9.1.7
@angular-devkit/schematics        9.1.7
@angular/cli                      9.1.7
@ngtools/webpack                  9.1.7
@schematics/angular               9.1.7
@schematics/update                0.901.7
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

package.json : package.json

{
  "name": "scada",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~9.1.0",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "@babel/polyfill": "^7.10.1",
    "jquery": "^3.5.1",
    "rxjs": "~6.5.4",
    "svgedit": "^5.1.0",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.901.0",
    "@angular/cli": "~9.1.0",
    "@angular/compiler-cli": "~9.1.0",
    "@angular/language-service": "~9.1.0",
    "@types/node": "^12.11.1",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.4.1",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~3.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~5.4.3",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~3.8.3"
  }
}

I had the same error when I used contentful in my angular app.当我在我的 angular 应用程序中使用内容时,我遇到了同样的错误。 You can add these lines to your app.component:您可以将这些行添加到您的 app.component:

import "core-js/stable";
import "regenerator-runtime/runtime";

I found it here: https://github.com/zloirock/core-js#babelpolyfill我在这里找到它: https://github.com/zloirock/core-js#babelpolyfill

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM