28 lines
707 B
TypeScript
28 lines
707 B
TypeScript
import { defineConfig, loadEnv } from "vite";
|
|
import eslintPlugin from "vite-plugin-eslint";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import mkcert from "vite-plugin-mkcert";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ command, mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), '')
|
|
|
|
if (command === "build") {
|
|
return {
|
|
base: `${env.ASSET_URL}/dist/`,
|
|
plugins: [vue()]
|
|
};
|
|
} else {
|
|
return {
|
|
base: `${env.ASSET_URL}/dist/`,
|
|
cors: {
|
|
origin: "*",
|
|
methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
|
|
preflightContinue: false,
|
|
optionsSuccessStatus: 204,
|
|
},
|
|
plugins: [eslintPlugin(), mkcert(), vue()],
|
|
};
|
|
}
|
|
});
|