// 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"; import vueJsx from '@vitejs/plugin-vue-jsx' 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: [ createVuePlugin(), vueJsx({ // options are passed on to @vue/babel-plugin-jsx }) ], optimizeDeps:{ // exclude:["hi-ui"],//冷启动时,排除的包 }, devServer: { port:227, proxy: 'http://192.168.1.183:5001/' } })