// vite.config.js 利害浏览器自带的 es 动态导入,使项目冷启动 const { resolve } = require('path'); import { defineConfig } from 'vite' // import vue from '@vitejs/plugin-vue' //(1) // import { createVuePlugin } from "vite-plugin-vue2"; const { createVuePlugin } = require('vite-plugin-vue2') // import viteExmaple from "./vite-plugin/exmaple.js"; // import viteServe from "./vite-plugin/server"; let build = { sourcemap: false, //编译 //指定 多个 .html 文件作为入口点 rollupOptions: { // 请确保外部化那些你的库中不需要的依赖 // external: ['vue'], input: { main: resolve(__dirname, 'index.html'), nested: resolve(__dirname, 'nested/index.html') }, output: { format: 'umd', } } } // https://vitejs.dev/config/ export default defineConfig({ build:build, css: { preprocessorOptions: { less: { javascriptEnabled: true, } }, }, resolve: { extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue', '.dtvevt', '.dtv'], alias: { // 'vue$': 'vue/dist/vue.esm.js', '@admin':resolve('project/admin'), // 注意: 静态资源通过src,不能这么设置。 // "@assets": path.join(__dirname, "..", "src", "assets"), } }, // plugins: [vue()] //(1) plugins: [ createVuePlugin() ], optimizeDeps:{ // exclude:["hi-ui"],//冷启动时,排除的包 }, compilerOptions: { "jsx": "preserve" }, devServer: { port:227, proxy: 'http://192.168.1.183:5001/' } })