import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import commonjs from 'vite-plugin-commonjs';
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
	plugins: [
		uni(),
		createSvgIconsPlugin({
			iconDirs: [path.resolve(process.cwd(), 'src/static/icons')], // SVG 目录
			symbolId: 'icon-[name]', // 符号 ID 格式
		}),
		commonjs({
			include: ['./src/g3d.min.js'] // 兼容commonJS
		})
	],

	// css公共变量
	css: {
		preprocessorOptions: {
			less: {
				additionalData: `@import "@/styles/variables.less";`
			}
		}
	}
	// envDir: './config/env',   // 指定环境文件目录
	// envPrefix: ['VITE_', 'UNI_'] // 白名单前缀
});