Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
JavaScript Modules & Current Updates
Search
Rizqy Hidayat
November 23, 2021
Programming
0
91
JavaScript Modules & Current Updates
Rizqy Hidayat
November 23, 2021
Tweet
Share
More Decks by Rizqy Hidayat
See All by Rizqy Hidayat
HTMX: Back to Basic
rizqyhi
0
51
Exploring PEMPA Architecture on Dicoding.com
rizqyhi
0
32
Menjelajah Dunia Frontend Lebih Jauh
rizqyhi
0
14
Introduction to Open Source & Hacktoberfest
rizqyhi
0
100
Frontend is Enough
rizqyhi
0
30
Other Decks in Programming
See All in Programming
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
170
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
CSC307 Lecture 09
javiergs
PRO
1
830
AWS re:Invent 2025参加 直前 Seattle-Tacoma Airport(SEA)におけるハードウェア紛失インシデントLT
tetutetu214
2
110
Basic Architectures
denyspoltorak
0
660
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.1k
「ブロックテーマでは再現できない」は本当か?
inc2734
0
710
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
160
CSC307 Lecture 01
javiergs
PRO
0
690
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.3k
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
21k
Designing for Timeless Needs
cassininazir
0
130
A designer walks into a library…
pauljervisheath
210
24k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
250
Game over? The fight for quality and originality in the time of robots
wayneb77
1
110
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
88
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
0
1.9k
The agentic SEO stack - context over prompts
schlessera
0
630
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
110
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
160
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!