import { defineConfig } from "vite"; import legacy from "@vitejs/plugin-legacy"; import vitePluginImp from "vite-plugin-imp"; const path = require("path"); // https://vitejs.dev/config/ export default defineConfig({ // root: "./public/", base: "./", define: { // isProdEnv: NODE_ENV === "production", // apiGlobalPrefix: JSON.stringify(""), // "process.env": "{}", }, plugins: [ legacy({ targets: ["defaults", "not IE 11"], }), vitePluginImp({ libList: [ // { libName: "antd", style: name => `antd/es/${name}/style/index.css` }, ], }), ], publicDir: "public", resolve: { alias: { "~": path.resolve(__dirname, "./"), "@": path.resolve(__dirname, "./src/"), }, }, css: { preprocessorOptions: { less: { javascriptEnabled: true, modifyVars: { // "white": "#3C3F41", // "primary-color": "#3C3F41", }, } }, modules: { localsConvention: "camelCaseOnly" } }, clearScreen: true, server: { host: "0.0.0.0", port: 8000, proxy: { "/api/": { target: "http://127.0.0.1:18081", changeOrigin: true, // rewrite: path => path, }, "/api/ws/": { target: "http://127.0.0.1:18081", changeOrigin: true, ws: true, }, }, force: true, }, build: { target: "modules", polyfillDynamicImport: false, outDir: "dist", assetsDir: "assets", assetsInlineLimit: 4096, cssCodeSplit: true, rollupOptions: { external: [], plugins: [ ], output: { // name: name, // exports: 'named', // format: 'amd', sourcemap: true, }, }, }, });