r/typescript • u/DanielRosenwasser • Mar 09 '23
TypeScript's Migration to Modules
https://devblogs.microsoft.com/typescript/typescripts-migration-to-modules2
50
u/del_rio Mar 09 '23
TS itself using esbuild for bundling and compiling is a massive endorsement for the library, and quite the performance win, too!
19
u/lifeeraser Mar 10 '23
varis faster thanlet
Premature optimization! Premature optimization!
J/K. This was a really insightful article. Thanks to the TypeScript team for creating and maintaining such a wonderful tool.
6
u/NewLlama Mar 09 '23
11
u/stevedorries Mar 09 '23
Wouldn’t a single tab increase those savings even further though?
9
u/Bake_Jailey Mar 10 '23
It would, but esbuild hardcodes two spaces, so that's what we get.
(And I wasn't about to post-process the output like that; makes source maps break and making them not break is a lot of extra time/effort. Moderately pointless when the package compresses so well.)
2
u/kopps1414 Mar 10 '23
Y'all are the best - thanks Jake & Daniel! For the continued great work, and then the super informative posts like these 🙇
8
u/seemslikesalvation Mar 10 '23
Is there a name for the almost-but-not-quite-ESM syntax that most projects actually use -- importing Node modules by name like
import foo from '@some/module', or from a folder that has anindex.[jt]sx?likeimport {foo} from './path/to/folder'?I've seen it called Harmony modules, but then I've also read that Harmony was just the name for ESM before ESM was standardized.