import { fileURLToPath, URL } from "node:url"; import eslintPlugin from 'vite-plugin-eslint'; import WindiCSS from 'vite-plugin-windicss' import path from "path" import { defineConfig } from "vite"; import legacy from "@vitejs/plugin-legacy"; import vue2 from "@vitejs/plugin-vue2"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ vue2(), WindiCSS(), legacy({ targets: ["ie >= 11"], additionalLegacyPolyfills: ["regenerator-runtime/runtime"], }), eslintPlugin({ include: ['src/**/*.js', 'src/**/*.vue', 'src/*.js', 'src/*.vue'], }), ], css: { preprocessorOptions: { scss: { additionalData:'@import "./src/assets/style/main.scss";' } } }, resolve: { alias: { "@": path.resolve(__dirname, 'src'), }, }, server: { // 是否开启 https https: false, // 端口号 port: 3000, // 监听所有地址 host: "0.0.0.0", // 服务启动时是否自动打开浏览器 open: true, }, build: { // 设置最终构建的浏览器兼容目标 target: "es2015", // 构建后是否生成 source map 文件 sourcemap: false, // chunk 大小警告的限制(以 kbs 为单位) chunkSizeWarningLimit: 2000, // 启用/禁用 gzip 压缩大小报告 reportCompressedSize: false, }, });