-
Notifications
You must be signed in to change notification settings - Fork 275
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
Generate a list of assets to cache for offline support #1573
Conversation
…mments and errors
/** | ||
* Files needed only by the Playground.WordPress.Net server. | ||
*/ | ||
'/.htaccess', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brandonpayton Are we good to remove the .htaccess
file now that Playground runs on the Atomic platform?
Co-authored-by: Adam Zieliński <[email protected]>
packages/vite-extensions/vite-list-assets-required-for-offline-mode.ts
Outdated
Show resolved
Hide resolved
…-mode.ts Co-authored-by: Adam Zieliński <[email protected]>
packages/vite-extensions/vite-list-assets-required-for-offline-mode.ts
Outdated
Show resolved
Hide resolved
…-mode.ts Co-authored-by: Adam Zieliński <[email protected]>
packages/vite-extensions/vite-list-assets-required-for-offline-mode.ts
Outdated
Show resolved
Hide resolved
packages/vite-extensions/vite-list-assets-required-for-offline-mode.ts
Outdated
Show resolved
Hide resolved
…-mode.ts Co-authored-by: Adam Zieliński <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All my notes are related to code style and comments, the essence of this PR is spot on. Thank you @bgrgicak!
I addressed everything, should be ready to merge now. |
Motivation for the change, related issues
To make Playground available offline we will need to precache all Playground assets.
This PR generates a list of all assets Playground needs to run offline.
#1535 will use the asset file.
Implementation details
The PR implements a new Vite plugin (
websiteCachePathsPlugin
). The plugin runs every time the website is built and scans through thewebsite
,remote
, andclient
dist folders for cache files.We need to do this because Vite generates new file names on each build. For example
index.js
will beindex-HASH.js
.To detect all required files, the plugin has a list of regex expressions that will match these files no matter what hash Vite generates.
Testing Instructions (or ideally a Blueprint)
npm run build:website
dist/packages/playground/wasm-wordpress-net/cache-files.json
exists