2017-07-17 115 views
0

我正在使用TypeScript和Rollup的組合,如this article中所示。使用TypeScript和Rollup與TypeScript源地圖

因此math.ts

export function square(x: number) { 
    return x ** 2; 
} 

export function cube(x: number) { 
    return x ** 3; 
} 

main.ts

import { square } from "./math"; 

console.log(square(3)); 

命令後,生成

tsc -t ES5 -m es2015 && rollup -f es -o app.js -m -i main.js 

文件app.js

function square(x) { 
    return Math.pow(x, 2); 
} 

console.log(square(3)); 
//# sourceMappingURL=app.js.map 

但顯然源代碼映射是用於捆綁JavaScript而不是TypeScript。這是不知何故可以生成app.ts.map

回答

-1

這在某種程度上可能產生app.ts.map

你想錯了。您生成了.js文件和生成的.js.map文件,其中包含TS文件代碼信息

您不需要.ts.map來查看ts源