19.01.2017 CPHJS @penzington
New docs! webpack.js.org
https://github.com/pekala/cphjs-webpack-fun
https://cphjs-webpack-fun.surge.sh
Uses webpack@1
Built with webpack's production flag
https://cphjs-webpack-fun.surge.sh/step1/
Code on GitHub
Set process.env.NODE_ENV to "production"
Sets React to production mode
https://cphjs-webpack-fun.surge.sh/step2/
Small changes in config syntax
Understands ES6 modules
Introduces "tree shaking"
Warnings for large bundles
https://cphjs-webpack-fun.surge.sh/step3/
Don't import/require polyfills from code
Create a separate bundle for them in webpack config
Inject script tag for browsers that need it
Defer application init to after polyfills are loaded
https://cphjs-webpack-fun.surge.sh/step4/
Plugins allows to override default behaviour
Helps removing unwanted dynamic requires
https://cphjs-webpack-fun.surge.sh/step5/
Identify non-crucial parts of the functionality
Use import('...') syntax to async require modules
webpack automatically creates chunks for lazy loading
Gotcha: you need to teach babel to ignore import function
https://cphjs-webpack-fun.surge.sh/step6/
ES6-API-compatible leaner React replacement
Drops support for older syntax and older browser support
preact-compat makes it a drop-in replacement
wepack resolve aliases or "fake" React packages
https://cphjs-webpack-fun.surge.sh/step7/
800KB (214 KB gzip) ➡️ 51KB (17KB gzip)
More on webpagetest.org
Video - Moto G with Slow 3G
Maciek Pekala
@penzington
By Maciek Pekala
Deck for lightning talk presented at CopenhagenJS meetup on 19.01.2017
Frontend and frontend ops @issuu