Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/plugins-service/bin/build-service-worker
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [ $NODE_ENV == 'development' ]; then
ln -snf "$ROOT"/../dist/ "$DESKTOP_DIR"/service-worker
fi

yarn vite build --config ../vite.config.ts --mode $NODE_ENV $VITE_ARGS
yarn vite build --config ../vite.config.mts --mode $NODE_ENV $VITE_ARGS

if [ $NODE_ENV == 'production' ]; then
# In production, just copy the built files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import path from 'path';

import { defineConfig } from 'vite';

// eslint-disable-next-line import/no-default-export
export default defineConfig(({ mode }) => {
const isDev = mode === 'development';
const outDir = path.resolve(__dirname, 'dist');
const buildHash = Date.now().toString(36);

return {
mode,
Expand All @@ -18,7 +18,8 @@ export default defineConfig(({ mode }) => {
entry: path.resolve(__dirname, 'src/plugin-service-worker.ts'),
name: 'plugin_sw',
formats: ['iife'],
fileName: () => (isDev ? 'plugin-sw.dev.js' : 'plugin-sw.[hash].js'),
fileName: () =>
isDev ? `plugin-sw.dev.js` : `plugin-sw.${buildHash}.js`,
},
sourcemap: true,
minify: isDev ? false : 'terser',
Expand Down
7 changes: 7 additions & 0 deletions upcoming-release-notes/5928.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
category: Bugfix
authors: [lelemm]
---

Fix service worker to generate a new hash with every build for better caching.