Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
1
560
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
330
Other Decks in Technology
See All in Technology
なぜ使われないのか?──定量×定性で見極める本当のボトルネック
kakehashi
PRO
1
760
Design System Documentation Tooling 2025
takanorip
1
930
MCP・A2A概要 〜Google Cloudで構築するなら〜
shukob
0
160
Ryzen NPUにおけるAI Engineプログラミング
anjn
0
210
会社紹介資料 / Sansan Company Profile
sansan33
PRO
11
390k
Eight Engineering Unit 紹介資料
sansan33
PRO
0
5.7k
Capture Checking / Separation Checking 入門
tanishiking
0
110
Security Diaries of an Open Source IAM
ahus1
0
110
eBPFとwaruiBPF
sat
PRO
2
940
ECMAScript仕様の最新動向: プロセスの変化と仕様のトレンド
uhyo
2
490
ページの可視領域を算出する方法について整理する
yamatai1212
0
160
AIにおける自由の追求
shujisado
3
470
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
The World Runs on Bad Software
bkeepers
PRO
72
12k
4 Signs Your Business is Dying
shpigford
186
22k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Thoughts on Productivity
jonyablonski
73
5k
BBQ
matthewcrist
89
9.9k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.6k
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.1k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
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