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
今から始めるClaude Code超入門
448jp
8
8.5k
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
150
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
680
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
640
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
2.4k
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
110
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
420
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
250
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
600
Featured
See All Featured
Unsuck your backbone
ammeep
671
58k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.8k
Odyssey Design
rkendrick25
PRO
1
490
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.4k
Exploring anti-patterns in Rails
aemeredith
2
250
Prompt Engineering for Job Search
mfonobong
0
160
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
Faster Mobile Websites
deanohume
310
31k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
430
What does AI have to do with Human Rights?
axbom
PRO
0
2k
Agile that works and the tools we love
rasmusluckow
331
21k
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!