akauppi / GroundLevel-firebase-es

[ANCHORED] Stencil for operational web apps
https://groundlevel-sep22.web.app/
Other
23 stars 3 forks source link

`next-may22`: Optimize initial loading #87

Closed akauppi closed 2 years ago

akauppi commented 2 years ago

Due to changes (abandoning app-deploy-ops) we are less in control of how the modules get loaded.

<< Chunks are loaded in by roll/out/index.html:

```
<link rel="modulepreload" href="main-3feb35cf.js">
<link rel="prefetch" as="script" href="adapters-f273c2ba.js">
<link rel="modulepreload" href="firebase-5dc6e54f.js">
<link rel="prefetch" as="script" href="ops-ea693b58.js">
<link rel="modulepreload" href="firebase-performance-ce7d4c56.js">
<link rel="prefetch" as="script" href="app.es-ed65462e.js">
<link rel="modulepreload" href="app/vue-01885567.js">
<link rel="modulepreload" href="firebase-auth-d6ea998a.js">
<link rel="modulepreload" href="firebase-firestore-90758cb6.js">
<link rel="modulepreload" href="app/aside-keys-3fd8741c.js">
<link rel="modulepreload" href="app/vue-router-5519ae70.js">
<link rel="modulepreload" href="tslib-9956b3d6.js">
```

Notice how some of the files are `modulepreload`ed whereas others are just `prefetch`ed.

When the browser processes `index.html`, it can start *all* of these fetches at once. If the server is HTTP/2 capable (Firebase hosting is), you'll get *one delivery* for all of them.

These should optimize your web app's loading time. It's always worth to measure those, to be sure.

<<

akauppi commented 2 years ago

Vite (3.0.0-alpha.1) automatically adds modulepreload so we are good to go!

Also, Lighthouse score is 99%, 100% on both local and deployed.