Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent and handle code splitting errors #187

Open
3 tasks
incognitojam opened this issue Feb 9, 2025 · 0 comments
Open
3 tasks

Prevent and handle code splitting errors #187

incognitojam opened this issue Feb 9, 2025 · 0 comments

Comments

@incognitojam
Copy link
Member

incognitojam commented Feb 9, 2025

Read more: http://dimaip.github.io/2020/04/25/deploying-apps-with-code-splitting/

Build outputs look like this:

dist/index.html                                  1.35 kB │ gzip:  0.66 kB
dist/assets/PairActivity-BPbpkqiC.css            0.15 kB │ gzip:  0.13 kB
dist/assets/index-BLtQcLjs.css                  45.82 kB │ gzip: 12.63 kB
dist/assets/logout-6J7o6Pym.js                   0.53 kB │ gzip:  0.35 kB │ map:     0.45 kB
dist/assets/auth-CKGUWZk1.js                     0.73 kB │ gzip:  0.48 kB │ map:     1.29 kB
dist/assets/client-C0K2Vm7w.js                   2.09 kB │ gzip:  1.15 kB │ map:     6.09 kB
dist/assets/login-Bo5badKx.js                    3.35 kB │ gzip:  1.56 kB │ map:     7.01 kB
dist/assets/Button-BrY1xdFa.js                   3.82 kB │ gzip:  1.79 kB │ map:    10.51 kB
dist/assets/PairActivity-Cr6LpKkh.js            18.43 kB │ gzip:  6.82 kB │ map:    38.69 kB
dist/assets/qr-scanner-worker.min-D-EgXUP3.js   44.34 kB │ gzip: 10.65 kB │ map:    45.01 kB
dist/assets/index-CRJamWYb.js                  114.92 kB │ gzip: 41.12 kB │ map:   688.65 kB
dist/assets/index-t_HHjCnB.js                  211.89 kB │ gzip: 65.40 kB │ map:   864.67 kB
dist/assets/RouteVideoPlayer-u3jjkh1a.js       286.60 kB │ gzip: 90.01 kB │ map: 1,141.68 kB

If the user is browsing the app and doesn't load PairActivity-*.js yet, but we deploy an update which renames/deletes that file, when the app goes to load it there will be a JS error.

Tasks:

  • CI: deploy artifacts from previous builds together with new build
    • Cloudflare may cache files for some amount of time already
  • ServiceWorker: precache all JS bundles
    • Once we have PWA/ServiceWorker setup, we can use precacheAndRoute from Workbox
  • fix: catch exceptions during lazy loading and force-reload app
    • does not preserve state, but last resort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant