4 Star 0 Fork 0

billowC/vue3+JS+view-ui-plus+pinia

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vite.config.js 2.73 KB
一键复制 编辑 原始数据 按行查看 历史
billowC 提交于 2023-02-09 23:32 . 初始基础架搭建
import { defineConfig } from 'vite'
import vueJsx from '@vitejs/plugin-vue-jsx'
import vue from '@vitejs/plugin-vue'
import * as path from 'path'
import { resolve } from 'path'
// 实现 组件的按需加载
// 当引入 "unplugin-vue-components/vite 组件之后,页面中需要引入组件的地方就都不需要引入了
//import Components from "unplugin-vue-components/vite";
//import {
// ViewUIResolver
//} from "unplugin-vue-components/resolvers";
// // 实现 Vue及Vue相关的库、api的 按需加载
import AutoImport from "unplugin-auto-import/vite";
// https://vitejs.dev/config/
export default defineConfig({
base: '/competition-front/',
plugins: [vue({
reactivityTransform: true, //ref配置为$ref
}),
vueJsx({
// include: ["**/*.vue"]
// options are passed on to @vue/babel-plugin-jsx
}),
// ant自动引入组件配置后会引起ant主题定制出错
//Components({
// resolvers: [
// ViewUIResolver()
// ]
//}),
AutoImport({
// include: [
// // /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
// /\.vue$/, /\.vue\?vue/, // .vue
// ],
imports: ["vue", "vue-router", "pinia"],
})
],
resolve: {
//设置别名
alias: [
{
find: "@",
replacement: path.resolve(__dirname, "src"),
},
{
find: "common",
replacement: path.resolve(__dirname, "src/common"),
},
{
find: "components",
replacement: path.resolve(__dirname, "src/components"),
},
]
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
// 用于全局导入,以避免需要单独导入每个样式文件。
// reference: 避免重复引用
hack: `true; @import (reference) "${resolve("src/style/variable.less")}"; `,
},
// 使用javascript能力定制主题
// 设置为true后可以定制化主题,在main.js中引入'ant-design-vue/dist/antd.less'文件进行编译
// 这个项目UI库可能用到 iview 而不是 ant
javascriptEnabled: true,
}
}
},
// 打包配置
build: {
minify: 'terser',
terserOptions: {
compress: {
//生产环境时移除console
drop_console: true,
drop_debugger: true,
},
},
},
server: {
host: '0.0.0.0',
port: 2200
// proxy: 'http://192.168.3.221:80'
// proxy: 'https://g.aomao.com/latex'
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/billowC/vue3--js-view-ui-plus-pinia.git
git@gitee.com:billowC/vue3--js-view-ui-plus-pinia.git
billowC
vue3--js-view-ui-plus-pinia
vue3+JS+view-ui-plus+pinia
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385