xtraderClient/vite.config.ts

28 lines
727 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
export default defineConfig({
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
plugins: [
vue(),
// 2. 将此插件添加到插件数组中
nodePolyfills({
// 为了彻底解决SIWE等库的问题建议包含以下选项
protocolImports: true,
}),
],
// 3. 可选但推荐:显式定义 process.env 以避免其他潜在错误
define: {
'process.env': {},
},
server: {
host: true, // 监听 0.0.0.0,允许局域网内其他设备访问
},
})