Skip to content

Commit 756fe3f

Browse files
committed
fix: windows compatibility
1 parent 6e2cdb9 commit 756fe3f

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ help: ## Show this help message
102102

103103
## Development
104104
ifeq ($(OS),Windows_NT)
105-
dev: node_modules/.installed build-main clean-cache ## Start development server (Vite + nodemon watcher for Windows compatibility)
105+
dev: node_modules/.installed build-main ## Start development server (Vite + nodemon watcher for Windows compatibility)
106106
@echo "Starting dev mode (2 watchers: nodemon for main process, vite for renderer)..."
107107
# On Windows, use npm run because bunx doesn't correctly pass arguments to concurrently
108108
# https://github.com/oven-sh/bun/issues/18275
109109
@NODE_OPTIONS="--max-old-space-size=4096" npm x concurrently -k --raw \
110-
"bun x nodemon --exec node scripts/build-main-watch.js" \
110+
"bun x nodemon --watch src --watch tsconfig.main.json --watch tsconfig.json --ext ts,tsx,json --ignore dist --ignore node_modules --exec node scripts/build-main-watch.js" \
111111
"vite"
112112
else
113113
dev: node_modules/.installed build-main ## Start development server (Vite + tsgo watcher for 10x faster type checking)
@@ -125,7 +125,7 @@ dev-server: node_modules/.installed build-main ## Start server mode with hot rel
125125
@echo "For remote access: make dev-server VITE_HOST=0.0.0.0 BACKEND_HOST=0.0.0.0"
126126
@# On Windows, use npm run because bunx doesn't correctly pass arguments
127127
@npmx concurrently -k \
128-
"npmx nodemon --exec node scripts/build-main-watch.js" \
128+
"npmx nodemon --watch src --watch tsconfig.main.json --watch tsconfig.json --ext ts,tsx,json --ignore dist --ignore node_modules --exec node scripts/build-main-watch.js" \
129129
"npmx nodemon --watch dist/main.js --watch dist/main-server.js --delay 500ms --exec \"node dist/main.js server --host $(or $(BACKEND_HOST),localhost) --port $(or $(BACKEND_PORT),3000)\"" \
130130
"$(SHELL) -lc \"MUX_VITE_HOST=$(or $(VITE_HOST),127.0.0.1) MUX_VITE_PORT=$(or $(VITE_PORT),5173) VITE_BACKEND_URL=http://$(or $(BACKEND_HOST),localhost):$(or $(BACKEND_PORT),3000) vite\""
131131
else

src/main.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
4141

4242
// Register service worker for PWA support
4343
if ("serviceWorker" in navigator) {
44-
window.addEventListener("load", () => {
45-
navigator.serviceWorker
46-
.register("/service-worker.js")
47-
.then((registration) => {
48-
console.log("Service Worker registered:", registration);
49-
})
50-
.catch((error) => {
51-
console.log("Service Worker registration failed:", error);
52-
});
53-
});
44+
const isHttpProtocol = window.location.protocol === "http:" || window.location.protocol === "https:";
45+
if (isHttpProtocol) {
46+
window.addEventListener("load", () => {
47+
navigator.serviceWorker
48+
.register("/service-worker.js")
49+
.then((registration) => {
50+
console.log("Service Worker registered:", registration);
51+
})
52+
.catch((error) => {
53+
console.log("Service Worker registration failed:", error);
54+
});
55+
});
56+
}
5457
}

0 commit comments

Comments
 (0)