代码拉取完成,页面将自动刷新
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",
// },
// ],
// }),
],
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。