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
Progressive Web Apps with React.js in a nutshel...
Search
Jimmy Moon
May 20, 2016
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Progressive Web Apps with React.js in a nutshell at Google I/O devfest 2016
Progressive Web Apps with React.js in a nutshell at Google I/O devfest 2016
Jimmy Moon
May 20, 2016
More Decks by Jimmy Moon
See All by Jimmy Moon
Operating an AI Infrastructure Through MCP Apps on Agents
ragingwind
0
50
Coding as Prompting Since 2025
ragingwind
0
940
Edge Computing for WebApp
ragingwind
0
160
Micro-Saas for developer who want a new
ragingwind
0
130
How to use The Fourth Language
ragingwind
0
250
Please Use The Fourth Language - WebAssembly
ragingwind
0
270
Head topics in Javascript, 2020
ragingwind
1
750
Recap Modern WebAssembly in CDS 2019
ragingwind
0
370
Today headlines in Javascript, 2019
ragingwind
0
570
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
280
The Limits of Empathy - UXLibs8
cassininazir
1
680
Technical Leadership for Architectural Decision Making
baasie
3
570
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
810
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Discover your Explorer Soul
emna__ayadi
2
1.3k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Documentation Writing (for coders)
carmenintech
77
5.5k
How to Ace a Technical Interview
jacobian
281
24k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Transcript
Progressive Web Apps with React.js in a Nutshell
Progressive Web Apps with React.js in a Nutshell https://medium.com/@addyosmani
https://medium.com/@addyosmani - Part 1 - Introduction - Part 2 -
Page Load Performance - Part 3 - Offline support and network resilience - Part 4 - Progressive Enhancement
Github / NPM +JimmyMoon @ragingwind Google Developer Expert
Part 1 - Introduction for Progressive Web Apps
https://react-hn.appspot.com
ȍȇȇ app.yaml ȍȇȇ dist ȍȇȇ hn-server-fetch.js: unofficial hn APIs ȍȇȇ
nwb.config.js: nwb config ȍȇȇ package.json ȍȇȇ public Ȉ ȍȇȇ index-static.html Ȉ ȍȇȇ manifest.json Ȉ ȍȇȇ runtime-caching.js Ȉ Ȍȇȇ service-worker.js ȍȇȇ server.js ȍȇȇ src Ȉ ȍȇȇ App.js: App and Components Ȉ ȍȇȇ Comment.js Ȉ ȍȇȇ Item.js Ȉ ȍȇȇ NotFound.js Ȉ ȍȇȇ PermalinkedComment.js Ȉ ȍȇȇ Settings.js Ȉ ȍȇȇ Updates.js Ȉ ȍȇȇ UserProfile.js Ȉ ȍȇȇ index.js Ȉ ȍȇȇ routes.js Ȉ ȍȇȇ services: fetch APIs Ȉ ȍȇȇ stores: cache, store data Ȉ ȍȇȇ utils Ȉ Ȍȇȇ views: template Ȍȇȇ sw-precache-config.json - React.js ӝࠄੋ ࣗझ ܻ - nwb ਸ ࢎਊೞৈ ۽ં ࢤࢿ/ҙܻ - editing nwb.config.js - HackerHN Firebase APIs ࢎਊ
- ୡࠁ ѐ֛ ӝਊ - React.js ୭न ߡ - Webpack
2 - Code-spliting - Tree-shaking - Commonchunk - and More - PRPL ಁఢ ਊ - Service Worker పझ ਗ - ݒఠܻ ٣ੋ with React MDL - рױೠ ҳઑ৬ ࠭ https://github.com/ ragingwind/bare-react-pwa
https://github.com/GoogleChrome/lighthouse - ֎ਖ োѾ উ - Add to Home screen
ࢎਊ оמ ৈࠗ - Custom splash screen ࢎਊ оמ ৈࠗ - য়ۄੋա ৌঈೠ ֎ਖ ജ҃ী ز оמ ৈࠗ - ಕ ۽٘ ࢿמ যځೠ - ݽ߄ੌ-۪ٜܻ ٣ੋਸ ࢎਊ೮ח - Progressively enhanced ܳ ਗೞח জ ੋ - ࣗହ ࢝җ ੜ ݒ غח Lighthouse Auditing tools for Progressive Web App
Ready for Mobile Platform - ઁח ݽ߄ੌ ۖಬ ୭ࢶ ఋ
ۖ ಬ - ݽ߄ੌ ജ҃ী ೠ JS Libraries/ Frameworks ࢎਊೞ - preact - AngularJS 2 Mobile - पઁ ݽ߄ੌജ҃ա ਬࢎജ҃ীࢲ పझ ೞ - Remote Debugging Android Devices - WebPagetest
HTTPS Network connection is secure - ӝઓ HTTP ࢚ ೧ఊ
߂ উࢿ ࠁ৮ - Service Worker/Push Notification ܳ ࢎਊೞৈ ࢎਊо જইೞח জਸ ٜ݅ӝ ਤ೧ࢲ - അ ޖܐ/о ࣛܖ࣌ ࢎਊоמ - Let's Encrypt - Cloudlare - Google App Engine for Node.js - Github Pages
None
Web App Manifest Add to Home screen - рױೠ JSON
ੌ - ࢸ оמೠ (Installable) ਢজਸ ਤೠ ࢸ ٜ, ܴ, ই١ - Install Banner/Add to Home Screen - Splash Screen - Theme Color
Install Banners - ࢎਊೞח ࢎਊীѱ জਸ рױ ࢸ ೞب۾
ӂਬ - Home Screen ী ١۾ػ জ ҃ ߑ ޙਯ ब ೱ࢚оמ
Splash Screen - ؊࢚ ۽٬ ֢-ച-झܽ Ӓ݅ - ֎౭࠳ জҗ
э ҃ ઁҕ - Chrome, Firefox and Opera supports - Safari have broken in iOS9
http://realfavicongenerator.net/
http://app-manifest.firebaseapp.com/
$ npm install -g pwa-manifest
None
Mobile-Friendly Design - ݽ߄ੌ-ब ٣ੋਸ ೞ݅ … ؘझ ب
݃ࣁਃ - Responsive Web Design - নೠ ೧࢚ب/ࣄٜ ীࢲ ࢎਊ ࠛಞহ ز೧ঠ פ
- meta “viewport” ܳ ࢎਊೞৈ ࠳ۄઉ viewport ܳ ઑೞࣁਃ
None
Part 2 - Page Load Performance
None
Performance Goal - RAIL ಁఢ L(Loading under 1sec) ী ೞࣁਃ
- ֎ਖ ઑѤਸ ղܻҊ ࢎೱ ೞ٘ਝযী ࢲب ࠙ ੜ ز೧ঠפ. - ߑޙदীח 5 ୡ ղ(Speed Index of 3,000 or less) - ߑޙद(with S/W, Speed Index of 1,000 or less)ীח 2 ୡղ জ ࢎਊ ઑী ߈೧ঠפ.
None
None
None
None
None
None
https://twitter.com/samccone/status/771786445015035904
None
None
None
None
Code-splitting by routes - ೞա ੌਸ ۄ ӝ߈ਵ۽ ܻ࠙
- ܲ ۄী ਃೠ ੌٜ റী ߹ ب۽ ۽٬оמ (Lazy-loading) - ୡӝ ۄ ࢿמ ೱ࢚ਵ۽ ࢎਊ ࢎਊо מ दр খѹ
None
monolithic bundles code-splitting by routes
- নೠ Webpack ۞Ӓੋਵ۽ ਊਸ ੌ ࣻ - CommonsChunkPlugin,
п Entrypoint ীࢲ ҕਊਵ۽ ࢎਊغח ܳ ܻ࠙, ࢎਊоמ - Tree Shaking, ؘ٘٘ ઁѢ۽ ਊ য оמ (but Webpack 2) More plugins for Webpack
Preload - ࢶ݅ਵ۽ ܻࣗझ ಁ оמ (प೯হ) - Әөח only
in Chrome
None
Implementing PRPL - Push - HTTP/2 + Server Push -
Preload / Defer load - AggressiveSplittingPlugin - Rendering - ࢎਊೞח JS ۨਕܳ ୭ೠ ഝਊೞࣁਃ - Pre-caching: - sw-precache - SWPrecacheWebpackPlugin - Lazy-load - require.ensure() or System.import()
Cache-busting - ਬפೠ ੌݺਸ ࢎਊೞৈ ܻࣗझܳ ഛ पೞѱ ҙܻೞח ߑߨ
- ٘ ӝ߈ ܻࣗझ ܻࣗझ ҙܻ ߑߨ - ୶оੋ ܴਸ ؊ೞח ߑध - chunk.js?v=1.2.0 - chunk.d9834554decb6a8j.js - ࠂੌ ۽٘ ߑ - ݆ Webpack Plugins ࢎਊоמ
Webpack 2 Tree Shaking - ES2015 ীࢲ ࢎਊ, - Dead
Code (Unused export) ઁѢ
Part 3 - Offline support and network resilience
None
ServiceWoker - Offline-dinosaur ܳ લӝ ਤ೧ࢲ కয լणפ - ߔӒۄ٘
ীࢲ ߹ب۽ ز - ߄ झ݀۽ ۽Ӓې߁ оמ - cache, fetch, sync ਵ۽ ֎ਖ ਃ ઁ য оמ - Push notification ࢎਊ оמ - IndexedDB ࢎਊ оמ - য়ۄੋ ࡺ݅ ইפۄ ࠛউೠ ֎ਖ ജ ҃ীࢲب ୭࢚ জ ҃ ઁҕ
None
None
None
None
None
None
None
None
None
Chrome DevTools for Service Worker - DevTools > Application tab
> Service Workers - 3G throttling and CPU throttling ࢎਊ ೧ࢲ ୭ೠ ࠺तೠ ജ҃ীࢲ పझܳ ӂ
App Shell Architecture - ֎౭࠳ জ(জۨ) җ э ࡅܲ ۽٬
ਸ ࠁৈח ೠо ߑߨ - PWA ীࢲ ઁউೞח ইఃఫ - ୭Ҋೠ HTML, CSS and JavaScript ۽ জ ӝࠄ ҎѺ UI ܳ ҳࢿ - Toolbars, Drawers, Navigation - ࢲ࠺झ ਕழܳ ਊ೧ࢲ ޖઑѤ நए
None
App Shell Caching via Service Worker in low-friction - vanilla.js
ਸ ࢎਊೞӝ - sw-precache / sw-toolbox ࢎਊೞӝ - Webpack ۞Ӓੋ ࢎਊೞӝ - offline-plugin - sw-precache-webpack-plugin - create-react-pwa ۽ ۽ં ࢤࢿ
None
None
config.json
webpack.config.js
Using runtime/dynamic caching with sw-toolbox
None
None
Part 4 - Progressive Enhancement Building Progressively Becoming Apps Alex
Russell - Progressive Web Apps: Escaping Tabs Without Losing Our Soul
None
Universal Rendering - ࢲߡীࢲ ࢤࢿػ ୡӝ HTML ஶబஎܳ ߄ ۽
࣠ - ୡӝ ۪؊݂द ୶о HTML/JS/CSS ੌ Fetching ਸ ઁೠ - React.js / ழޭפ౭ ৌആ ਗ - ReactDOMServer.renderToStrin g() - React Router - isomorphic-fetch
None
Pro React - https://goo.gl/EXRM3k
None
None
None
None
None
Guarding against globals - ࢲߡ Node.js ജ҃ীࢲ زೡ ҃ `document`
ژח `window` ёܳ ഛ ੋೡ ਃо णפ. - ReactDOM but 3rd party ஹನք ࢎ ਊ ਗৈࠗ ഛੋ - Webpack ߣٜ݂द `browser` ః (package.json) ܳ ਊೞৈ JS ੌਸ ܻ࠙೧ࢲ ࢎਊоמ
Remember: Interactivity is key - ਬפߡࢸ ۪؊݂ ߈٘द জ ޖઑѤ
TTI ࢚కо ػח Ѫਸ ೞ ঋणפ . - प೯ী ਃೠ ୭ࣗೠ HTML җ ۄ ী ਃೠ JS/CSS ܳ ࢎਊೞࣁਃ - റী ਃೠ ܻࣗझ৬ ٘ܳ ۽٘ ೧ࢲ ରਵ۽ ӝמਸ ୶о दఃࣁਃ (PRLP ಁఢ)
- JS Based Render: HTML ׳ റ ݆
ੌਸ פ. ݽٚ झ݀ ۽٘ ӒܻҊ य, प೯غযঠ জ प೯ؾפ - Server render + Hydrate / Fastboot: ݽٚ ߄झ݀о ز оמ೧ঠ ৮߷ زפ. (uncanny valley) - Progressive Render: ࣻ زী ਃ ೠ ୭ࣗೠ HTML/JS/CSS ܳ ׳ೞৈ زоמೞѱ ೞҊ റ ରਵ۽ ࠁъ פ
- JS Based Render: HTML ׳ റ ݆
ੌਸ פ. ݽٚ झ݀ ۽٘ ӒܻҊ य, प೯غযঠ জ प೯ؾפ Server render + Hydrate / Fastboot: ݽٚ ߄झ݀о ز оמ೧ঠ ৮߷ زפ. (uncanny valley) - Progressive Render: Sending only functionally viable(minimal) view in the HTML, JS, CSS included, and more resource arrive progressively
- JS Based Render: HTML ׳ റ ݆
ੌਸ פ. ݽٚ झ݀ ۽٘ ӒܻҊ य, प೯غযঠ জ प೯ؾפ Server render + Hydrate / Fastboot: ݽٚ ߄झ݀о ز оמ೧ঠ ৮߷ زפ. (uncanny valley) - Progressive Render: ࣻ زী ਃ ೠ ୭ࣗೠ HTML/JS/CSS ܳ ׳ೞৈ زоמೞѱ ೞҊ റ ରਵ۽ ࠁъ פ
Testing Progressive Enhancement - ୭Ӕ ٣ߡӦ ో ߄झ݀о হח ҃
, ֎ਖ ജ҃ જ ঋ ҃ܳ दޯ ۨ оמפ.
http://slack.gdg.kr/ /join #pwa
Fin