- Learn React with TypeScript 3
- Carl Rippon
- 157字
- 2021-06-10 19:16:36
Module formats
Modules feature in JavaScript as part of ES6, which is great. However, lots of code exists in other popular module formats that came before this standardization. TypeScript allows us to write our code using ES6 modules, which can then transpile into another module format if specified.
Here is a brief description of the different module formats that TypeScript can transpile to:
- Asynchronous Module Definition (AMD): This is commonly used in code targeted for the browser and uses a define function to define modules.
- CommonJS: This format is used in Node.js programs. It uses module.exports to define modules and require to define dependencies.
- Universal Module Definition (UMD): This can be used in both browser apps and Node.js programs.
- ES6: This is the native JavaScript module format and uses the export keyword to define modules and import to define dependencies.
In the following sections (and, in fact, this whole book), we'll write our code using ES6 modules.
推薦閱讀
- VMware View Security Essentials
- FuelPHP Application Development Blueprints
- Data Analysis with Stata
- PhpStorm Cookbook
- Instant RubyMotion App Development
- Building an RPG with Unity 2018
- Working with Odoo
- 深入分布式緩存:從原理到實踐
- Swift 4從零到精通iOS開發(fā)
- Visual Basic 6.0程序設(shè)計實驗教程
- Apache Camel Developer's Cookbook
- 運維前線:一線運維專家的運維方法、技巧與實踐
- Advanced UFT 12 for Test Engineers Cookbook
- 網(wǎng)絡(luò)數(shù)據(jù)采集技術(shù):Java網(wǎng)絡(luò)爬蟲實戰(zhàn)
- C++ System Programming Cookbook