Fix browser WebSocket bundle

This commit is contained in:
2026-07-19 13:24:03 +08:00
parent 761956f047
commit 7c19234523
+8 -1
View File
@@ -1,8 +1,16 @@
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import { resolve } from 'node:path';
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [vue()],
resolve: {
alias: {
// stompjs' package entry also imports its Node.js transport. Use the
// browser-only build so Vite does not emit a bare "websocket" import.
stompjs: resolve(__dirname, 'node_modules/stompjs/lib/stomp.js'),
},
},
define: { define: {
global: 'globalThis', global: 'globalThis',
}, },
@@ -21,4 +29,3 @@ export default defineConfig({
} }
} }
}); });