Is there source map support for typescript in node / nodemon?

前端 未结 5 2177
盖世英雄少女心
盖世英雄少女心 2021-01-31 14:34

I have a node project written in typescript@2.

My tsconfig has sourceMap set to true and the *.map.js files are generated. When I

5条回答
  •  眼角桃花
    2021-01-31 15:24

    The answers here are correct for Node versions before v12.12.0, which added the (experimental) --enable-source-maps flag. With that enabled, source maps are applied to stack traces without an additional dependency. As demonstrated in this article, it has the slightly different and possibly beneficial behavior of including both the generated .js file location and the source file location. For example:

    Error: not found
        at Object. (/Users/bencoe/oss/source-map-testing/test.js:29:7)
            -> /Users/bencoe/oss/source-map-testing/test.ts:13:7
    

提交回复
热议问题