123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- import path from "path"
- import { defineConfig } from "vite"
- import Vue from "@vitejs/plugin-vue"
- import Pages from "vite-plugin-pages"
- import Layouts from "vite-plugin-vue-layouts"
- import Icons from "unplugin-icons/vite"
- import IconsResolver from "unplugin-icons/resolver"
- import Components from "unplugin-vue-components/vite"
- import AutoImport from "unplugin-auto-import/vite"
- import WindiCSS from "vite-plugin-windicss"
- import { VitePWA } from "vite-plugin-pwa"
- import VueI18n from "@intlify/vite-plugin-vue-i18n"
- import Inspect from "vite-plugin-inspect"
- import ViteFonts from "vite-plugin-fonts"
- export default defineConfig({
- resolve: {
- alias: {
- "~/": `${path.resolve(__dirname, "src")}/`,
- },
- },
- plugins: [
- Vue({
- include: [/\.vue$/, /\.md$/],
- }),
- // https://github.com/hannoeru/vite-plugin-pages
- Pages({
- extensions: ["vue", "md"],
- }),
- // https://github.com/JohnCampionJr/vite-plugin-vue-layouts
- Layouts(),
- // https://github.com/antfu/unplugin-auto-import
- AutoImport({
- imports: [
- "vue",
- "vue-router",
- "vue-i18n",
- "@vueuse/head",
- "@vueuse/core",
- ],
- dts: "src/auto-imports.d.ts",
- }),
- // https://github.com/antfu/unplugin-vue-components
- Components({
- // allow auto load markdown components under `./src/components/`
- extensions: ["vue", "md"],
- // allow auto import and register components used in markdown
- include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
- // custom resolvers
- resolvers: [
- // auto import icons
- // https://github.com/antfu/unplugin-icons
- IconsResolver({
- componentPrefix: "",
- // enabledCollections: ['carbon']
- }),
- ],
- dts: "src/components.d.ts",
- }),
- // https://github.com/antfu/unplugin-icons
- Icons({
- autoInstall: true,
- }),
- // https://github.com/antfu/vite-plugin-windicss
- WindiCSS({}),
- // https://github.com/antfu/vite-plugin-pwa
- VitePWA({
- registerType: "autoUpdate",
- includeAssets: ["favicon.ico", "robots.txt", "safari-pinned-tab.svg"],
- manifest: {
- name: "Vitesse",
- short_name: "Vitesse",
- theme_color: "#ffffff",
- icons: [
- {
- src: "/pwa-192x192.png",
- sizes: "192x192",
- type: "image/png",
- },
- {
- src: "/pwa-512x512.png",
- sizes: "512x512",
- type: "image/png",
- },
- {
- src: "/pwa-512x512.png",
- sizes: "512x512",
- type: "image/png",
- purpose: "any maskable",
- },
- ],
- },
- }),
- // https://github.com/intlify/bundle-tools/tree/main/packages/vite-plugin-vue-i18n
- VueI18n({
- runtimeOnly: true,
- compositionOnly: true,
- include: [path.resolve(__dirname, "locales/**")],
- }),
- // https://github.com/antfu/vite-plugin-inspect
- Inspect({
- // change this to enable inspect for debugging
- enabled: false,
- }),
- // https://github.com/stafyniaksacha/vite-plugin-fonts
- ViteFonts({
- google: {
- families: ["Inter", "Roboto Mono"],
- },
- }),
- ],
- server: {
- fs: {
- strict: true,
- },
- },
- // https://github.com/antfu/vite-ssg
- ssgOptions: {
- script: "async",
- formatting: "minify",
- },
- optimizeDeps: {
- include: ["vue", "vue-router", "@vueuse/core", "@vueuse/head"],
- exclude: ["vue-demi"],
- },
- })
|