Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
es module bundling with webpack 2
Search
cjies
March 29, 2017
Technology
590
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
410
Other Decks in Technology
See All in Technology
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
280
AIにシークレットを見せない、WSL2で安全な開発環境
yazm
0
140
Post AI時代のリファクタリング実践記 / Refactoring in the post AI era
kaminashi
1
190
ハードウェアコンペでもAI駆動開発が進んでいる話
iotengineer22
1
710
Kiro Crewをはじめよう
kizawa2020
1
150
不可逆な意思決定を避けながら10億超の顧客データを AI Ready にするデータ基盤設計
baseballyama
1
310
二歩目のフロントエンド・ウェブアクセシビリティ
camiha
2
440
AI時代だからこそ推したい!Gitコマンド再入門
munakata
0
180
hackers_champloo_2026_tidb
makocchi
0
140
自分で立ててみるLLMサービス
y_sera15
0
160
大型犬好きによるPugの紹介
yamanoku
1
150
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
880
Featured
See All Featured
For a Future-Friendly Web
brad_frost
184
10k
Typedesign – Prime Four
hannesfritz
42
3.2k
A Tale of Four Properties
chriscoyier
163
24k
The Pragmatic Product Professional
lauravandoore
37
7.5k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
The Language of Interfaces
destraynor
162
27k
Crafting Experiences
bethany
1
380
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
480
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
620
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
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