allow config from .env
This commit is contained in:
parent
6bff440aa0
commit
4a673797ec
@ -1,20 +1,20 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import eslintPlugin from "vite-plugin-eslint";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
import mkcert from "vite-plugin-mkcert";
|
||||
|
||||
const ASSET_URL = process.env.ASSET_URL || '';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ command }) => {
|
||||
export default defineConfig(({ command, mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
|
||||
if (command === "build") {
|
||||
return {
|
||||
base: `${ASSET_URL}/dist/`,
|
||||
base: `${env.ASSET_URL}/dist/`,
|
||||
plugins: [vue()]
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
base: `${ASSET_URL}/dist/`,
|
||||
base: `${env.ASSET_URL}/dist/`,
|
||||
cors: {
|
||||
origin: "*",
|
||||
methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user