cool-admin-vue/vite.config.ts

60 lines
1.1 KiB
TypeScript
Raw Normal View History

2021-03-30 18:23:08 +08:00
import path from "path";
2021-10-27 19:15:27 +08:00
import { UserConfig } from "vite";
2021-03-30 18:23:08 +08:00
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
2021-10-13 16:17:59 +08:00
import viteCompression from "vite-plugin-compression";
import Components from "unplugin-vue-components/vite";
2022-04-12 19:36:11 +08:00
import Unocss from "unocss/vite";
import { presetUno } from "unocss";
2022-05-18 15:09:13 +08:00
import { proxy } from "./src/cool/config/proxy";
import { cool } from "./build/cool";
import { svgBuilder } from "./build/svg";
2021-03-30 18:23:08 +08:00
function resolve(dir: string) {
return path.resolve(__dirname, ".", dir);
}
// https://vitejs.dev/config/
export default (): UserConfig => {
return {
base: "/",
2021-12-05 23:09:33 +08:00
plugins: [
vue(),
viteCompression(),
Components(),
vueJsx(),
2022-04-12 19:36:11 +08:00
Unocss({
presets: [presetUno()]
}),
2021-12-05 23:09:33 +08:00
svgBuilder("./src/icons/svg/"),
cool()
],
2022-04-13 01:57:36 +08:00
css: {
preprocessorOptions: {
scss: {
charset: false
}
}
},
resolve: {
alias: {
"/@": resolve("src"),
2021-04-03 13:37:52 +08:00
"/#": resolve("types"),
2022-04-02 22:50:51 +08:00
"/$": resolve("src/modules")
}
2021-03-30 18:23:08 +08:00
},
server: {
2022-04-06 02:36:20 +08:00
port: 9000,
2021-10-27 19:15:27 +08:00
proxy,
hmr: {
2021-04-02 19:00:16 +08:00
overlay: true
}
},
2021-04-02 19:00:16 +08:00
build: {
sourcemap: false,
2021-04-03 13:37:52 +08:00
polyfillDynamicImport: false // 必须为false
2021-04-02 19:00:16 +08:00
}
};
};