mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-09 06:03:01 -05:00
🐛 Fix Service Worker: New hash every build (#5928)
* New hash every build * Add release notes for PR #5928 * trigger actions * Changed from TS to MTS * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
@@ -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',
|
||||
7
upcoming-release-notes/5928.md
Normal file
7
upcoming-release-notes/5928.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [lelemm]
|
||||
---
|
||||
|
||||
Fix service worker to generate a new hash with every build for better caching.
|
||||
|
||||
Reference in New Issue
Block a user