zterton-status/vite.config.ts
2021-10-14 15:43:47 +01:00

91 lines
2.0 KiB
TypeScript

import path from 'path'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import Pages from 'vite-plugin-pages'
import { imagetools } from 'vite-imagetools'
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 WindiCSS from 'vite-plugin-windicss'
import AutoImport from 'unplugin-auto-import/vite'
import VueI18n from '@intlify/vite-plugin-vue-i18n'
export default defineConfig({
resolve: {
alias: {
'~/': `${path.resolve(__dirname, 'src')}/`,
'@/': `${path.resolve(__dirname, 'src/components')}/`,
},
},
plugins: [
Vue(),
// https://github.com/hannoeru/vite-plugin-pages
Pages(),
imagetools(),
// https://github.com/JohnCampionJr/vite-plugin-vue-layouts
Layouts({
layoutsDir: 'src/layouts',
defaultLayout: 'Default'
}),
// https://github.com/antfu/unplugin-auto-import
AutoImport({
imports: [
'vue',
'vue-router',
'vue-i18n',
'@vueuse/head',
'@vueuse/core',
],
dts: true,
}),
// https://github.com/antfu/vite-plugin-components
Components({
resolvers: [
// auto import icons
// https://github.com/antfu/vite-plugin-icons
IconsResolver({
componentPrefix: '',
enabledCollections: ['carbon'],
}),
],
dts: true,
}),
// https://github.com/antfu/vite-plugin-icons
Icons({
autoInstall: true,
}),
// https://github.com/antfu/vite-plugin-windicss
WindiCSS({
}),
VueI18n({
runtimeOnly: true,
compositionOnly: true,
include: [path.resolve(__dirname, 'locales/**')],
}),
],
server: {
fs: {
strict: true,
},
},
optimizeDeps: {
include: [
'vue',
'vue-router',
'@vueuse/core',
'@vueuse/head',
],
exclude: [
'vue-demi',
],
},
})