How do I turn off source maps for Angular 6 ng test?

允我心安 提交于 2019-12-03 11:17:16

问题


I am trying to turn off sourcemaps for my tests in Angular 6. I know the sourcemaps switch has been removed, e.g., ng test --sourcemaps=false. I have tried modifying my tsconfig file:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
  ...
  "sourceMap": false
},

as referenced by the angular.json test->configuration block:

"test": {
  ...
  "options": {
    ...
    "tsConfig": "src/tsconfig.spec.json",

The source maps are still being generated.


回答1:


You can use

CLI v6.0.8 and above --source-map=false

CLI v6.x --sourceMap=false

CLI v1.x --sourcemaps=false




回答2:


Angular CLI changing this param from version to version as per this answer:

CLI v6.0.8 and above
--source-map=false

CLI v6.0.x early versions
--sourceMap=false

CLI v1.x
--sourcemaps=false

Shortcut ng test -sm=false might also work

In case if you are on the latest CLI and none of above works you can always check the Options section at https://github.com/angular/angular-cli/blob/master/docs/documentation/test.md for the recent param name




回答3:


Angular CLI v6.x reads --source-map as --sourceMap. So both --source-map and --sourceMap works for me for CLI v6.0.8

Go to package.json Change "test":"ng test" to "test":"ng test --source-map=false" to turn off sourcemaps.

Please note it shoud be --source-map and not --source-maps.



来源:https://stackoverflow.com/questions/50761206/how-do-i-turn-off-source-maps-for-angular-6-ng-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!