123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import { defineConfig, loadEnv, ConfigEnv, UserConfig } from "vite";
- import { createHtmlPlugin } from "vite-plugin-html";
- import vue from "@vitejs/plugin-vue";
- import { resolve } from "path";
- // import eslintPlugin from "vite-plugin-eslint";
- import AutoImport from 'unplugin-auto-import/vite'
- import Components from 'unplugin-vue-components/vite'
- import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
- // https://vitejs.dev/config/
- export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
- const env = loadEnv(mode, process.cwd());
- return {
- resolve: {
- alias: {
- '~':resolve(__dirname, "./"),
- '@': resolve(__dirname, "./src")
- },
- },
- server: {
- host: "0.0.0.0",
- },
- plugins: [
- vue(),
- createHtmlPlugin({
- inject: {
- data: {
- title: env.VITE_BZD_ERP_APP_TITLE,
- },
- },
- }),
- // eslintPlugin({
- // include: ["src/**/*.js", "src/**/*.vue", "src/*.js", "src/*.vue"],
- // }),
- AutoImport({
- resolvers: [ElementPlusResolver()],
- }),
- Components({
- resolvers: [ElementPlusResolver()],
- }),
- ],
- // * 打包去除 console.log && debugger
- esbuild: {
- pure: env.VITE_DROP_CONSOLE ? ["console.log", "debugger"] : [],
- },
- };
- });
|