test
This commit is contained in:
30
zhandianxinxi/光谱数据监控/vite.config.js
Normal file
30
zhandianxinxi/光谱数据监控/vite.config.js
Normal file
@ -0,0 +1,30 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
export default defineConfig({
|
||||
// --- 强烈建议新增这一行 ---
|
||||
// 这确保 index.html 引用 css/js 时使用相对路径,
|
||||
// 避免 Flask 托管时出现找不到文件的 404 错误。
|
||||
base: './',
|
||||
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
}
|
||||
},
|
||||
|
||||
// --- 关于这段 server 配置 ---
|
||||
// 这里的配置仅在你自己电脑上写代码(npm run dev)时有效。
|
||||
// 打包(npm run build)后,前端请求会直接发给同源的 Flask,
|
||||
// 所以这里填什么 IP 对打包后的程序没有影响,不用改。
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:5000',
|
||||
changeOrigin: true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user