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
cjies
March 29, 2017
Technology
570
1
Share
es module bundling with webpack 2
F2E&RGBA Meetup 三月號
cjies
March 29, 2017
More Decks by cjies
See All by cjies
git, let it flow!
cjies
9
2.3k
git flow
cjies
0
350
Other Decks in Technology
See All in Technology
Amazon S3 Filesについて
yama3133
2
210
Good Enough Types: Heuristic Type Inference for Ruby
riseshia
1
230
AIを共同作業者にして書籍を執筆する方法 / How to Write a Book with AI as a Co-Creator
ama_ch
2
130
Shipping AI Agents — Lessons from Production
vvatanabe
0
240
みんなで作るAWS Tips 100連発 (FinOps編)
schwrzktz
1
300
ハーネスエンジニアリングをやりすぎた話 ~そのハーネスは解体された~
gotalab555
4
1.7k
AIでAIをテストする - 音声AIエージェントの品質保証戦略
morix1500
1
120
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
320
AIが書いたコードを信じられない問題 〜レビュー負荷を下げるために変えたこと〜 / The AI Code Trust Gap: Reducing the Review Burden
bitkey
PRO
7
1.3k
QGISプラグイン CMChangeDetector
naokimuroki
1
410
20年前の「OSS革命」に学ぶ AI時代の生存戦略
samakada
0
440
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
3.1k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
How to Ace a Technical Interview
jacobian
281
24k
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.3k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
200
Documentation Writing (for coders)
carmenintech
77
5.3k
Prompt Engineering for Job Search
mfonobong
0
270
Done Done
chrislema
186
16k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
420
Skip the Path - Find Your Career Trail
mkilby
1
110
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
130
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