diff options
author | 2021-08-17 12:26:06 -0700 | |
---|---|---|
committer | 2021-08-17 12:26:06 -0700 | |
commit | afcbcd231c9328bfd9b6ae8c81ea296d4235ae81 (patch) | |
tree | 9918fff9fb257ed6da6cbc093c74f7d478b07f1d /src/runtime/hmr.ts | |
parent | d7151f07bf41f617dd96bced381660fd48faebf1 (diff) | |
download | bun-afcbcd231c9328bfd9b6ae8c81ea296d4235ae81.tar.gz bun-afcbcd231c9328bfd9b6ae8c81ea296d4235ae81.tar.zst bun-afcbcd231c9328bfd9b6ae8c81ea296d4235ae81.zip |
Fix CSS bug, dont' run HMR code on server
Former-commit-id: 541084b7238d54d77cb13402274718311f2030b4
Diffstat (limited to '')
-rw-r--r-- | src/runtime/hmr.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/hmr.ts b/src/runtime/hmr.ts index 0d63c2f5c..99cdf634a 100644 --- a/src/runtime/hmr.ts +++ b/src/runtime/hmr.ts @@ -2,8 +2,8 @@ import { ByteBuffer } from "peechy"; import * as API from "../api/schema"; var __HMRModule, __FastRefreshModule, __HMRClient; -// We add a scope here to minimize chances of namespace collisions -{ +if (typeof window !== "undefined") { + // We add a scope here to minimize chances of namespace collisions var runOnce = false; var clientStartTime = 0; @@ -354,7 +354,7 @@ var __HMRModule, __FastRefreshModule, __HMRClient; } } - class HMRClient extends EventTarget { + class HMRClient { static client: HMRClient; socket: WebSocket; hasWelcomed: boolean = false; |