I'm using combination of TypeScript and Rollup as is presented in this article.
Thus math.ts
export function square(x: number) {
return x ** 2;
}
export function cube(x: number) {
return x ** 3;
}
and main.ts
import { square } from "./math";
console.log(square(3));
generates after command
tsc -t ES5 -m es2015 && rollup -f es -o app.js -m -i main.js
file app.js
function square(x) {
return Math.pow(x, 2);
}
console.log(square(3));
//# sourceMappingURL=app.js.map
But the generated source map points to the .js
output of tsc
, not the original .ts
files. How can I get the latter?
Follow the usage at the above link.
Or checkout Alex Jover's typescript-library-starter which uses the this plugin as well as others that might solve other problems for you. He also says:
If you use rollup-plugin-babel, you might be able to use the
inputSourceMap
option instead of this plugin.