js-pad/vite.config.js
2024-12-09 23:06:33 +08:00

39 lines
970 B
JavaScript
Raw Permalink 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, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
// import vueDevTools from 'vite-plugin-vue-devtools'
// https://vite.dev/config/
export default defineConfig((command, mode) => {
const env = loadEnv(mode, process.cwd());
return {
build: {
// 设置输出目录
outDir: 'out-render',
// 如果你想要在outDir外层再嵌套一层子目录可以通过assetsDir来实现
assetsDir: 'assets',
},
plugins: [
vue(),
// vueDevTools(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src/render', import.meta.url))
},
},
server: {
host: "0.0.0.0",
port: 17129,
proxy: {
[env.VITE_BASE_URL]: {
target: env.VITE_HTTP_PROXY,
changeOrigin: true,
rewrite: (path) => path.replace(new RegExp(env.VITE_BASE_URL), ''),
}
}
}
}
})