LOAD AN APPLICATION SHELL (OR APPSHELL) FIRST LINKIf the SPA architecture supports it, load an appshell first (i.e. minimal HTML, CSS and JavaScript to power the user interface), under https://www.mydomain.com/appshell/. Once loaded, the appshell will dynamically request content from the server through an API. Because all of the appshell’s assets can be precached using service workers, the website’s frame will load immediately, speeding up the first meaningful paint. This scenario uses the “cache falling back to network” caching strategy.Watch out for conflicts! For instance, WordPress outputs code that is not supposed to be cached and used forever, such as nonces, which usually expire after 24 hours. The appshell, which service workers will cache in the browser for more than 24 hours, needs to deal with nonces properly.EXTRACT WORDPRESS RESOURCES ADDED THROUGH WP_ENQUEUE_SCRIPT AND WP_ENQUEUE_STYLE LINK
Source: Implementing A Service Worker For Single-Page App WordPress Sites – Smashing Magazine