Angular 4 - 调试

时间:2017-10-13 14:11:52

标签: angular

我遇到了vscode调试器的问题。我尝试时遇到的第一个问题是(顺便说一下,当我在没有调试的情况下启动它时,项目工作得很好):

  使用类装饰器时需要

reflect-metadata shim

我在其他帖子上看到我必须将Reflect.js和zone.js包含到我的项目的angular-cli.json(是的,我使用angular-cli生成应用程序)。当我这样做时,第一个错误消失了,但我仍然得到了我在标题中提到的错误。

完整的问题是:

  

ReferenceError:未定义XMLHttpRequest       在patchXHR(c:\ Users \ axileo \ Documents \ angular-bc \ node_modules \ zone.js \ dist \ zone.js:2895:54)       在c:\ Users \ axileo \ Documents \ angular-bc \ node_modules \ zone.js \ dist \ zone.js:2882:5       在Function.Zone .__ load_patch(c:\ Users \ axileo \ Documents \ angular-bc \ node_modules \ zone.js \ dist \ zone.js:86:33)       在c:\ Users \ axileo \ Documents \ angular-bc \ node_modules \ zone.js \ dist \ zone.js:2880:6       在FUNCTION(c:\ Users \ axileo \ Documents \ angular-bc \ node_modules \ zone.js \ dist \ zone.js:9:65)       在对象。 (C:\用户\ axileo \文件\角-BC \ node_modules \ zone.js \ DIST \ zone.js:12:2)       在Module._compile(module.js:624:30)       at Object.Module._extensions..js(module.js:635:10)       在Module.load(module.js:545:32)       在tryModuleLoad(module.js:508:12)

这是我的angular-cli.json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "angular-bc"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": ["node_modules/zone.js/dist/zone.js", 
      "node_modules/reflect-metadata/Reflect.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",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "src/tsconfig.spec.json",
      "exclude": "**/node_modules/**"
    },
    {
      "project": "e2e/tsconfig.e2e.json",
      "exclude": "**/node_modules/**"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}

由于

0 个答案:

没有答案