Repository navigation
Replies: 1 comment
|
Yes. The programmatic API exposes const { create } = require('ts-node');
const fs = require('node:fs');
const path = require('node:path');
const filename = path.resolve('example.ts');
const source = fs.readFileSync(filename, 'utf8');
const service = create();
const javascript = service.compile(source, filename);
fs.writeFileSync('example.js', javascript);
console.log(javascript);Run this as I tested this with ts-node 10.9.2: the |
Uh oh!
There was an error while loading. Please reload this page.
Obviously ts-node transpiles into javascript first. Is it possible to access this javascript somehow, before it gets fed into node?
All reactions