- 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.
推薦閱讀
- C語言程序設(shè)計案例教程(第2版)
- x86匯編語言:從實模式到保護模式(第2版)
- Magento 2 Development Cookbook
- Animate CC二維動畫設(shè)計與制作(微課版)
- TypeScript圖形渲染實戰(zhàn):基于WebGL的3D架構(gòu)與實現(xiàn)
- Practical Game Design
- Java程序設(shè)計
- Mastering JBoss Enterprise Application Platform 7
- Asynchronous Android Programming(Second Edition)
- 用案例學(xué)Java Web整合開發(fā)
- 區(qū)塊鏈項目開發(fā)指南
- Xamarin Blueprints
- 一步一步跟我學(xué)Scratch3.0案例
- Web程序設(shè)計:ASP.NET(第2版)
- Drupal 8 Development:Beginner's Guide(Second Edition)