// The Lucia project. // Copyright 2023-2026 DSP, inc. All rights reserved. // Authors: // chiayin.kuo@dsp.im (chiayin), 2023/1/31 // cindy.chang@dsp.im (Cindy Chang), 2024/7/9 // imacat.yang@dsp.im (imacat), 2026/3/6 /** * @module vite.config * Vite build configuration with dev server proxy, * path aliases, and test environment settings. */ import { fileURLToPath, URL } from "node:url"; import { defineConfig, loadEnv } from "vite"; import vue from "@vitejs/plugin-vue"; export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd()).VUE_APP_API_URL; return{ plugins: [vue()], base: '/', resolve: { alias: { util: "util/", "@": fileURLToPath(new URL("./src", import.meta.url)), '/images': 'src/assets/images', } }, server: { host: 'localhost', port: 58249, proxy: { '/api': { target: env, changeOrigin: true, rewrite: path => path.replace(/^\/api/, ''), } }, }, optimizeDeps: { include: ['vue', 'vue-router', 'pinia', 'axios'] }, build: { commonjsOptions: { transformMixedEsModules: true, // Enable @walletconnect/web3-provider which has some code in CommonJS // esmExternals: true, // If you set esmExternals to true, this plugins assumes that all external dependencies are ES modules } }, test: { globals:true, environment: 'jsdom', // reporter: ['text', 'json', 'html', 'vue'], }, } });