加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vite.config.ts 2.24 KB
一键复制 编辑 原始数据 按行查看 历史
jingkai0714 提交于 2022-06-09 11:08 . littlechange
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
import { visualizer } from "rollup-plugin-visualizer";
import externalGlobals from "rollup-plugin-external-globals";
import commonjs from "rollup-plugin-commonjs";
import importToCDN from "vite-plugin-cdn-import";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
export default defineConfig({
mode: "production",
base: "./",
server: {
port: 8000,
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
"%views": path.resolve(__dirname, "src/views"),
"%assets": path.resolve(__dirname, "src/assets"),
"%comps": path.resolve(__dirname, "src/components"),
},
},
// build: {
// rollupOptions: {
// external: ["Vue", "VueRouter", "dayjs", "axios"],
// plugins: [
// commonjs(),
// externalGlobals({
// Vue: "vue",
// ElementPlus: "element-plus",
// VueRouter: "vue-router",
// // pinia: "pinia",
// dayjs: "dayjs",
// axios: "axios",
// }),
// ],
// },
// },
plugins: [
vue(),
visualizer(),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
// importToCDN({
// modules: [
// {
// name: "vue",
// var: "Vue",
// // path、css来源于下面的图片
// path: "https://unpkg.com/vue@3.2.25",
// },
// {
// name: "element-plus",
// var: "ElementPlus",
// path: "https://unpkg.com/element-plus",
// css: "https://unpkg.com/element-plus/dist/index.css",
// },
// {
// name: "pinia",
// var: "pinia",
// path: "https://unpkg.com/pinia",
// },
// {
// name: "vue-router",
// var: "VueRouter",
// path: "https://unpkg.com/vue-router@4",
// },
// {
// name: "dayjs",
// var: "dayjs",
// path: "https://unpkg.com/dayjs@1",
// },
// {
// name: "axios",
// var: "axios",
// path: "https://unpkg.com/axios@0",
// },
// ],
// }),
],
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化