1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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,
- },
- },
- },
- });
|