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
89
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
43
Exploring PEMPA Architecture on Dicoding.com
rizqyhi
0
28
Menjelajah Dunia Frontend Lebih Jauh
rizqyhi
0
9
Introduction to Open Source & Hacktoberfest
rizqyhi
0
93
Frontend is Enough
rizqyhi
0
28
Other Decks in Programming
See All in Programming
Azure SRE Agentで運用は楽になるのか?
kkamegawa
0
2.4k
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
440
Zendeskのチケットを Amazon Bedrockで 解析した
ryokosuge
3
310
RDoc meets YARD
okuramasafumi
4
170
「手軽で便利」に潜む罠。 Popover API を WCAG 2.2の視点で安全に使うには
taitotnk
0
870
ProxyによるWindow間RPC機構の構築
syumai
3
1.2k
OSS開発者という働き方
andpad
5
1.7k
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
Oracle Database Technology Night 92 Database Connection control FAN-AC
oracle4engineer
PRO
1
460
Flutter with Dart MCP: All You Need - 박제창 2025 I/O Extended Busan
itsmedreamwalker
0
150
アセットのコンパイルについて
ojun9
0
130
Kiroで始めるAI-DLC
kaonash
2
610
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
GraphQLとの向き合い方2022年版
quramy
49
14k
Typedesign – Prime Four
hannesfritz
42
2.8k
GitHub's CSS Performance
jonrohan
1032
460k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.6k
Designing Experiences People Love
moore
142
24k
Site-Speed That Sticks
csswizardry
10
820
Building a Scalable Design System with Sketch
lauravandoore
462
33k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
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!