Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
JavaScript Modules & Current Updates
Search
Rizqy Hidayat
November 23, 2021
Programming
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JavaScript Modules & Current Updates
Rizqy Hidayat
November 23, 2021
More Decks by Rizqy Hidayat
See All by Rizqy Hidayat
PHP in AI Age: The Laravel Way
rizqyhi
0
6
HTMX: Back to Basic
rizqyhi
0
60
Exploring PEMPA Architecture on Dicoding.com
rizqyhi
0
52
Menjelajah Dunia Frontend Lebih Jauh
rizqyhi
0
20
Introduction to Open Source & Hacktoberfest
rizqyhi
0
110
Frontend is Enough
rizqyhi
0
41
Other Decks in Programming
See All in Programming
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
520
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
360
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
330
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
300
SONY CISC-NEWS NWS-1750 + NWB-225 フレームバッファの NetBSD/news68k ドライバ実装 / OSC2026Hiroshima
tsutsui
0
130
What We Talk About When We Talk About XP
m_seki
2
660
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
2.3k
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
1
280
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
290
Heart of Swift Concurrency
koher
0
930
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
560
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
350
Featured
See All Featured
Joys of Absence: A Defence of Solitary Play
codingconduct
1
530
Statistics for Hackers
jakevdp
799
230k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
390
Fireside Chat
paigeccino
43
4k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
370
HDC tutorial
michielstock
2
880
Paper Plane (Part 1)
katiecoart
PRO
2
11k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
460
How STYLIGHT went responsive
nonsquared
100
6.3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
240
YesSQL, Process and Tooling at Scale
rocio
174
15k
Transcript
JavaScript Modules & Current Updates Rizqy Hidayat PRODUCT ENGINEER, DICODING
Aloha 👋 Rizqy Hidayat PRODUCT ENGINEER, DICODING
[email protected]
- @rizqyhi
Prehistoric module Era 🦕 • • • JavaScript doesn't have
built-in support for modules Modular files, global scope Dependencies should be loaded before and configured manually
None
COMMONJS AMD UMD ESM Used in NodeJS (server) Used in
browser (client) Works for both node & browser Newest stanndard on ES6 ✨ History of Modules in JavaScript
CommonJS • • • Standard used in NodeJS for working
with modules Load modules synchronously Simple syntax
Asynchronous Module Definition (AMD) • • • • Alternative to
CommonJS, usually used in browser Needs library to handle module resolution Load modules asynchronously Slightly complex syntax
What if our library used by many teams? And they
used CommonJS and AMD?
Universal Module Definition (UMD) • • • Unify CommonJS and
AMD More complex syntax Use build tool to help generate exported modules
None
EcmaScript Module (ESM) • • • • Part of ES6/ES2015
standard The best from both CommonJS and AMD: Simple syntax Load module asynchronously
Use ESM in Browser Now • • • Import directly
from file/CDN No transpilation needed No need to bundle
None
Does it work on old browsers? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
ESM in Older Browser • • • Write code in
ES6 Transpile to ES5 Bundle into one file or split into chunks
Takeaways • • • • • Use ESM to work
with modules Write JavaScript in newest standard Or TypeScript if necessary Transpile to older format when in needs to support old browsers Use best tools available that suites your needs
Thanks!