Skip to content

A local-first personal finance app

🐛 Fix for worker in dev mode (#5878)

lelemm295839ebbb4f
diff --git a/packages/plugins-service/bin/build-service-worker b/packages/plugins-service/bin/build-service-worker
index 813463f3f7..9cffbdd32e 100755
--- a/packages/plugins-service/bin/build-service-worker
+++ b/packages/plugins-service/bin/build-service-worker
@@ -6,23 +6,23 @@ VITE_ARGS=""
DESKTOP_DIR="$ROOT"/../../desktop-client
SERVICE_WORKER_DIR="$DESKTOP_DIR"/service-worker
-mkdir -p "$SERVICE_WORKER_DIR"
# Clean out previous build files
rm -f ../dist/*
-rm -rf "$DESKTOP_DIR"/service-worker/*
+rm -rf "$DESKTOP_DIR"/service-worker
if [ $NODE_ENV == 'development' ]; then
if [ "$OSTYPE" == "msys" ]; then
# Ensure symlinks are created as native Windows symlinks.
export MSYS=winsymlinks:nativestrict
fi
- ln -snf "$ROOT"/../dist "$DESKTOP_DIR"/service-worker
+ ln -snf "$ROOT"/../dist/ "$DESKTOP_DIR"/service-worker
fi
yarn vite build --config ../vite.config.ts --mode $NODE_ENV $VITE_ARGS
if [ $NODE_ENV == 'production' ]; then
# In production, just copy the built files
+ mkdir -p "$SERVICE_WORKER_DIR"
cp -r ../dist/* "$DESKTOP_DIR"/service-worker
fi
\ No newline at end of file
diff --git a/upcoming-release-notes/5878.md b/upcoming-release-notes/5878.md
new file mode 100644
index 0000000000..752bd54e35
--- /dev/null
+++ b/upcoming-release-notes/5878.md
@@ -0,0 +1,7 @@
+---
+category: Bugfix
+authors: [lelemm]
+---
+
+Fix service worker issues in development mode by improving directory handling and symlink creation.
+