如何获取要在源目录而非Webpack捆绑目录中创建的.map文件

时间:2018-07-08 19:56:25

标签: visual-studio typescript webpack angular6

StackOverflow管理员-将其标记为重复时,请确保所引用的问题与以下内容有关:

  • Visual Studio 15.7.x-不是VS代码
  • .net core 2.1 Angular模板
  • 角度6

问题: 如何在源目录而不是webpack捆绑目录(即"./dist/out-tsc")中创建要创建的.map文件?

背景: 我使用.net core 2.1的VS模板创建了一个新的Angular Web。然后,我删除ClientApp文件夹并运行ng new ClientApp以创建Angular 6应用程序。除此之外,我没有更改任何设置,我只是在尝试运行英雄教程。

我得到的错误: 断点当前不会被命中。断点被忽略,因为找不到生成的代码(源映射问题?)

我尝试过的方法: 我注意到此设置为tsconfig:"outDir": "./dist/out-tsc" 我还注意到未创建dist目录。
我从命令行运行了tsc,该命令行创建了dist目录,并期望输出,包括.map文件。 如图所示,我在Startup.cs中更改了SourcePath:

spa.Options.SourcePath = "ClientApp/dist/out-tsc/src";

编辑:将"sourceRoot": "./",添加到tsconfig.json不起作用。

它仍然不起作用,与上面相同的错误。

环境: Visual Studio 2017 15.7.4

tsconfig.json

{
"compileOnSave": false,
"compilerOptions": {
  "baseUrl": "./",
  "outDir": "./dist/out-tsc",
  "sourceMap": true,
  "declaration": false,
  "moduleResolution": "node",
  "emitDecoratorMetadata": true,
  "experimentalDecorators": true,
  "target": "es5",
  "typeRoots": [
    "node_modules/@types"
  ],
  "lib": [
    "es2017",
    "dom"
  ]
}
}

package.json

{
"name": "client-app",
"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": "^6.0.3",
  "@angular/common": "^6.0.3",
  "@angular/compiler": "^6.0.3",
  "@angular/core": "^6.0.3",
  "@angular/forms": "^6.0.3",
  "@angular/http": "^6.0.3",
  "@angular/platform-browser": "^6.0.3",
  "@angular/platform-browser-dynamic": "^6.0.3",
  "@angular/router": "^6.0.3",
  "core-js": "^2.5.4",
  "rxjs": "^6.0.0",
  "zone.js": "^0.8.26"
},
"devDependencies": {
  "@angular/compiler-cli": "^6.0.3",
  "@angular-devkit/build-angular": "~0.6.8",
  "typescript": "~2.7.2",
  "@angular/cli": "~6.0.8",
  "@angular/language-service": "^6.0.3",
  "@types/jasmine": "~2.8.6",
  "@types/jasminewd2": "~2.0.3",
  "@types/node": "~8.9.4",
  "codelyzer": "~4.2.1",
  "jasmine-core": "~2.99.1",
  "jasmine-spec-reporter": "~4.2.1",
  "karma": "~1.7.1",
  "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"
}
}

0 个答案:

没有答案