28 lines
727 B
TypeScript
28 lines
727 B
TypeScript
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,允许局域网内其他设备访问
|
||
},
|
||
})
|