feat: build framework

This commit is contained in:
2024-03-19 22:51:10 +08:00
parent fbe51e7668
commit afb892c5e9
19 changed files with 2784 additions and 15 deletions

View File

@@ -1,7 +1,49 @@
import { defineConfig } from 'vite'
import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import * as path from 'path'
import legacyPlugin from '@vitejs/plugin-legacy'
// 自动导入vue中hook reactive ref等
import AutoImport from "unplugin-auto-import/vite"
//自动导入ui-组件 比如说ant-design-vue element-plus等
import Components from 'unplugin-vue-components/vite';
//ant-design-vue
import {AntDesignVueResolver} from "unplugin-vue-components/resolvers"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
//设置别名
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
plugins: [
vue(),
legacyPlugin({
targets: ['chrome 52'], // 需要兼容的目标列表
additionalLegacyPolyfills: ['regenerator-runtime/runtime'], // 面向IE11时需要此插件
}),
AutoImport({
//安装两行后你会发现在组件中不用再导入refreactive等
imports: ['vue', 'vue-router'],
dts: "auto-import.d.ts",
//ant-design-vue
resolvers: [AntDesignVueResolver()]
}),
Components({
//ant-design-vue importStyle = false 样式就没了
resolvers: [AntDesignVueResolver({importStyle: true, resolveIcons: true})],
}),
],
server: {
proxy: {
"/dev-api": {
//target是代理的目标路径
target: "",
changeOrigin: true, //必须要开启跨域
rewrite: (path) => path.replace(/\/dev-api/, ""), // 路径重写
},
},
}
})