$30 off During Our Annual Pro Sale. View Details »
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
Overture Maps Foundationの3年を振り返る
moritoru
0
160
エンジニアとPMのドメイン知識の溝をなくす、 AIネイティブな開発プロセス
applism118
4
1k
GitHub Copilotを使いこなす 実例に学ぶAIコーディング活用術
74th
3
1.7k
バグハンター視点によるサプライチェーンの脆弱性
scgajge12
3
1k
コミューンのデータ分析AIエージェント「Community Sage」の紹介
fufufukakaka
0
440
安いGPUレンタルサービスについて
aratako
2
2.6k
AI時代の開発フローとともに気を付けたいこと
kkamegawa
0
2.3k
Oracle Technology Night #95 GoldenGate 26ai の実装に迫る1
oracle4engineer
PRO
0
150
20251209_WAKECareer_生成AIを活用した設計・開発プロセス
syobochim
5
1.4k
EM歴1年10ヶ月のぼくがぶち当たった苦悩とこれからへ向けて
maaaato
0
270
非CUDAの悲哀 〜Claude Code と挑んだ image to 3D “Hunyuan3D”を EVO-X2(Ryzen AI Max+395)で動作させるチャレンジ〜
hawkymisc
1
160
ブロックテーマとこれからの WordPress サイト制作 / Toyama WordPress Meetup Vol.81
torounit
0
520
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1371
200k
How to Think Like a Performance Engineer
csswizardry
28
2.4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Docker and Python
trallard
47
3.7k
How to train your dragon (web standard)
notwaldorf
97
6.4k
A Tale of Four Properties
chriscoyier
162
23k
Into the Great Unknown - MozCon
thekraken
40
2.2k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
A better future with KSS
kneath
240
18k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
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