3 ms·
And adds its own layer of weirdness. Just one simple example: you must write `import { name } from "./file.js"`. Not `"./file.ts"`. Why js? Because TypeScript
by vbezhenar 3y ago
And adds its own layer of weirdness.
Just one simple example: you must write `import { name } from "./file.js"`.
Not `"./file.ts"`. Why js? Because TypeScript developers are stubborn that their thing is just a layer on top of JS so they refuse to change ".ts" to ".js" in the generated output. This is just wrong approach. But here we are, importing things from "./file.js" which doesn't even exist.
- leshenka 3y agoif `import { name } from "./file"` doesn't work for you, something's up with your setup
- shepherdjerred 3y agoI don't know the details, but I think there's some new-sh flag or something in TypeScript that requires the `.js` extension. I don't know if they're pushing that to be the default or what.
- vbezhenar 3y agoIf you use ESM modules, they won't resolve files without extensions.
- shepherdjerred 3y agoAh! That must be it. Yeah, super weird that you _have_ to put `.js` when that only exists at runtime