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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
Pure Intonation on Browser: Building a Sequencer with Ruby
nagachika
0
120
Good Enough Types: Heuristic Type Inference for Ruby
riseshia
1
230
弁護士ドットコム株式会社 エンジニア職向け 会社紹介資料
bengo4com
1
160
AI와 협업하는 조직으로의 여정
arawn
0
460
No Types Needed, Just Callable Method Check
dak2
1
1.3k
目的ファーストのハーネス設計 ~ハーネスの変更容易性を高めるための優先順位~
gotalab555
8
2.2k
基盤を育てる 外部SaaS連携の運用
gamonges_dresscode
1
120
EarthCopilotに学ぶマルチエージェントオーケストレーション
nakasho
0
300
AWS Agent Registry の基礎・概要を理解する/aws-agent-registry-intro
ren8k
3
380
AI時代における技術的負債への取り組み
codenote
1
1.5k
Revisiting [CLS] and Patch Token Interaction in Vision Transformers
yu4u
0
370
扱える不確実性を増やしていく - スタートアップEMが考える「任せ方」
kadoppe
0
300
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
140
ラッコキーワード サービス紹介資料
rakko
1
3.1M
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
160
Building the Perfect Custom Keyboard
takai
2
730
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
94
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
30 Presentation Tips
portentint
PRO
1
280
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
330
The Language of Interfaces
destraynor
162
26k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
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