【问题标题】:Avoid sourceMap files避免使用 sourceMap 文件
【发布时间】:2016-06-19 09:46:54
【问题描述】:

这是我的 tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "outDir": "wwwroot/app/source/"
  },
  "exclude": [
    "node_modules",
    "bower_components",
    "wwwroot",
    "typings/main",
    "typings/main.d.ts"
  ]
}

如您所见,sourceMap 选项设置为true,这是因为我需要它来调试我的应用程序。

但我只在 debug 模式 需要它,所以我想在运行 release 模式 gulp 脚本时将它设置为 false。

有没有办法强制--sourceMap=fase

【问题讨论】:

    标签: typescript gulp tsc


    【解决方案1】:

    您能举出 gulp 任务的代码示例吗 - gulp、gulp dist?

    我建议你应该使用插件 gulp-typescript 并在 gulp watch(默认开发任务)中使用插件 gulp-sourcemaps。在 gulp dist(或任何任务)中,您只需跳过 gulp-sourcemaps 管道,因此在 dist 版本中您将没有源图。

    或者您可以简单地使用两个不同的 tsconfig 文件 - dev / prod。并像gulp-typescript#using-tsconfigjson一样使用它们

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-02-06
      • 2013-05-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多