初始化
This commit is contained in:
@@ -1,15 +1,44 @@
|
||||
import {defineConfig} from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||
import path from "path";
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import { resolve } from 'path'
|
||||
|
||||
// import { viteSingleFile } from 'vite-plugin-singlefile'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: "./",
|
||||
plugins: [vue(), vueJsx()],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
export default ({ command }) => {
|
||||
const isBuild = command === 'build'
|
||||
return ({
|
||||
plugins: [
|
||||
vue(),
|
||||
vueJsx(),
|
||||
],
|
||||
define: {
|
||||
__VUE_OPTIONS_API__: false // 关闭 Vue2 中的 options选项API
|
||||
},
|
||||
},
|
||||
});
|
||||
base: './', // 使用相对路径
|
||||
resolve: {
|
||||
alias: [{ find: '@', replacement: resolve(__dirname, 'src') }]
|
||||
|
||||
},
|
||||
server: {
|
||||
port: 6003,
|
||||
host: true,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: `http://192.168.3.110:16003/`,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
},
|
||||
'/ws': {
|
||||
target: `ws://192.168.3.110:16003/`,
|
||||
changeOrigin: true,
|
||||
ws: true
|
||||
}
|
||||
}
|
||||
},
|
||||
oxc: {
|
||||
//清除全局的console.log和debug
|
||||
drop: isBuild ? ['console', 'debugger'] : [],
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user