mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-22 02:41:23 +01:00
Move env vars to vite config
This commit is contained in:
parent
839889ba63
commit
708af7efde
@ -26,6 +26,10 @@ export default defineConfig({
|
||||
"@": "frontend",
|
||||
},
|
||||
},
|
||||
define: {
|
||||
"process.env.WS_NO_BUFFER_UTIL": "true",
|
||||
"process.env.WS_NO_UTF_8_VALIDATE": "true",
|
||||
},
|
||||
},
|
||||
preload: {
|
||||
root: ".",
|
||||
|
@ -3,13 +3,12 @@ import type { WebSocket as NodeWebSocketType } from "ws";
|
||||
let NodeWebSocket: typeof NodeWebSocketType = null;
|
||||
|
||||
if (typeof window === "undefined") {
|
||||
try {
|
||||
// Necessary to avoid issues with Rollup: https://github.com/websockets/ws/issues/2057
|
||||
process.env.WS_NO_BUFFER_UTIL = "1";
|
||||
import("ws").then((ws) => (NodeWebSocket = ws.default));
|
||||
} catch (error) {
|
||||
console.log("Error importing 'ws':", error);
|
||||
}
|
||||
// Necessary to avoid issues with Rollup: https://github.com/websockets/ws/issues/2057
|
||||
import("ws")
|
||||
.then((ws) => (NodeWebSocket = ws.default))
|
||||
.catch((e) => {
|
||||
console.log("Error importing 'ws':", e);
|
||||
});
|
||||
}
|
||||
|
||||
type ComboWebSocket = NodeWebSocketType | WebSocket;
|
||||
|
Loading…
Reference in New Issue
Block a user