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
es module bundling with webpack 2
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
cjies
March 29, 2017
Technology
1
570
es module bundling with webpack 2
F2E&RGBA Meetup 三月號
cjies
March 29, 2017
Tweet
Share
More Decks by cjies
See All by cjies
git, let it flow!
cjies
9
2.3k
git flow
cjies
0
340
Other Decks in Technology
See All in Technology
OCI技術資料 : コンピュート・サービス 概要
ocise
4
54k
Cortex Code CLI と一緒に進めるAgentic Data Engineering
__allllllllez__
0
390
us-east-1 に障害が起きた時に、 ap-northeast-1 にどんな影響があるか 説明できるようになろう!
miu_crescent
PRO
13
4.4k
OpenClaw を Amazon Lightsail で動かす理由
uechishingo
0
120
わからなくて良いなら、わからなきゃだめなの?
kotaoue
1
360
身体を持ったパーソナルAIエージェントの 可能性を探る開発
yokomachi
1
130
僕、S3 シンプルって名前だけど全然シンプルじゃありません よろしくお願いします
yama3133
1
220
進化するBits AI SREと私と組織
nulabinc
PRO
0
200
Everything Claude Code を眺める
oikon48
8
5.5k
JAWS Days 2026 楽しく学ぼう! 認証認可 入門/20260307-jaws-days-novice-lane-auth
opelab
11
2.3k
TypeScript 7.0の現在地と備え方
uhyo
7
1.1k
ガバメントクラウドにおけるAWSの長期継続割引について
takeda_h
2
310
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Balancing Empowerment & Direction
lara
5
940
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
KATA
mclloyd
PRO
35
15k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Designing Powerful Visuals for Engaging Learning
tmiket
0
280
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
350
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.7k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
100
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Transcript
es module bundling with webpack 2 CJ 2017/03/29 F2E&RGBA Meetup
三⽉月號
CJies Tan front end n00b @ iCHEF cjies.com
webpack.js.org
webpack v2 stable released @ Jan 18
migrating to v2 https://webpack.js.org/guides/migrating/
webpack v2 features es6 support tree-shaking dynamic code-splitting build performance
improvement https://medium.com/webpack/webpack-2-and-beyond
es6 support no longer transpile import and export statements with
babel ["es2015", { "modules": false }]
tree-shaking • popularized by Rich Harris’ module bundler Rollup •
“mark” and drop unused exports • won’t work with CommonJS require https://blog.engineyard.com/2016/tree-shaking https://medium.com/@roman01la/dead-code-elimination-and-tree-shaking-in-javascript-build-systems
es ready libraries webpack 2 or rollup will resolve module
first if es6 supported { // commonJS entry "main": "lib/index.js", // es module entry "module": "es/index.js" } https://gist.github.com/cjies/31b602b53adf22320936663756abd61f https://github.com/rollup/rollup/wiki/pkg.module
tree-shaking demo https://github.com/cjies/tree-shaking-demo
issues to follow up webpack/webpack#2867 mishoo/UglifyJS2#1261
dynamic code-splitting
dynamic import() • webpack treats import() as a split-point. •
puts the request module in a separate chunk. • return a Promise.
https://webpack.js.org/guides/code-splitting-import/
react-async-component https://github.com/ctrlplusb/react-async-component
None
limitation of import() path // Wrong, no fully dynamic import(Math.random())
// ( Correct, support partially static import('./components/Product') import('./locale' + language + '.json')
$ exit thanks for your listening