TypeScript 为源Map添加一个选项,强制使用绝对路径?

jum4pzuy  于 9个月前  发布在  TypeScript
关注(0)|答案(3)|浏览(110)

之前的相关问题:VS2017与相对路径不兼容,当调试UWP应用时,现在尝试从应用URI加载源Map,而主机不支持它。

  1. 'WWAHost.exe' (Script): Loaded 'Script Code (MSAppHost/3.0)'.
  2. SourceMap ms-appx://6b826582-e42b-45b9-b4e6-dd210285d94b/js/require-config.js.map read failed: The URI prefix is not recognized..

在此处硬编码完整路径并不是一个好主意,我希望我们有一个选项可以像2.9.2版本那样工作,以便我们可以获得自动解析的完整路径。
编辑:在TS2.9中可以正常工作的tsconfig.json,但在TS3.0中无法正常工作:

  1. {
  2. "compilerOptions": {
  3. "strict": true,
  4. "noEmitOnError": true,
  5. "removeComments": false,
  6. "sourceMap": true,
  7. "target": "es2017",
  8. "outDir": "js/",
  9. "mapRoot": "js/",
  10. "sourceRoot": "sources/",
  11. "emitBOM": true,
  12. "module": "amd",
  13. "moduleResolution": "node"
  14. },
  15. "exclude": [
  16. "node_modules",
  17. "wwwroot"
  18. ]
  19. }

我尝试修复此问题的失败尝试(删除了mapRoot并更改了sourceRoot)

  1. {
  2. "compilerOptions": {
  3. "strict": true,
  4. "noEmitOnError": true,
  5. "removeComments": false,
  6. "sourceMap": true,
  7. "target": "es2017",
  8. "outDir": "js/",
  9. "sourceRoot": "../sources/",
  10. "emitBOM": true,
  11. "module": "amd",
  12. "moduleResolution": "node"
  13. },
  14. "exclude": [
  15. "node_modules",
  16. "wwwroot"
  17. ]
  18. }
9rygscc1

9rygscc12#

你找到解决这个问题的方法了吗?

xnifntxz

xnifntxz3#

VS停止支持JS项目,所以没有。

相关问题