Skip to content

Commit

Permalink
Tweak enablement; add cache id
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-matt-hillsdon committed May 29, 2024
1 parent f168fb7 commit 589b815
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
STAGING_CLOUDFRONT_DISTRIBUTION_ID: E2ELTBTA2OFPY2
REVIEW_CLOUDFRONT_DISTRIBUTION_ID: E3267W09ZJHQG9
VITE_FOUNDATION_BUILD: ${{ github.repository_owner == 'microbit-foundation' }}
# Optionally disable the PWA config (service worker and web manifest)
# DISABLE_PWA: '1'
# This feature is also controlled by a client-side feature flag that is disabled by default for the moment
FEATURE_PWA: ${{ github.repository_owner == 'microbit-foundation' }}

steps:
# Note: This workflow disables deployment steps and micro:bit branding installation on forks.
Expand Down
10 changes: 9 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,17 @@ export default defineConfig(({ mode }) => {
react(),
svgr(),
VitePWA({
disable: process.env.DISABLE_PWA === "1",
disable: process.env.FEATURE_PWA === "true",
registerType: "autoUpdate",
workbox: {
cacheId:
// v3 vs beta should have distinct caches
// for the moment we do this for all review stages too but likely that's too much over time
process.env.STAGE === "PRODUCTION" ||
process.env.STAGE === "STAGING" ||
process.env.STAGE === "REVIEW"
? process.env.BASE_URL.replaceAll("/", "") + "-"
: undefined,
// Only precache language assets for the fallback language.
// Cache other languages at runtime.
globIgnores: [
Expand Down

0 comments on commit 589b815

Please sign in to comment.