117 lines
2.7 KiB
TypeScript
117 lines
2.7 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'
|
|
import Markdown from 'vite-plugin-md'
|
|
import Inspect from 'vite-plugin-inspect'
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
'~/': `${path.resolve(__dirname, 'src')}/`,
|
|
'@/': `${path.resolve(__dirname, 'src/components')}/`,
|
|
},
|
|
},
|
|
plugins: [
|
|
Vue({
|
|
include: [/\.vue$/, /\.md$/], // <--
|
|
}),
|
|
|
|
// https://github.com/hannoeru/vite-plugin-pages
|
|
Pages({
|
|
extensions: ['vue', 'md'],
|
|
}),
|
|
imagetools(),
|
|
// https://github.com/JohnCampionJr/vite-plugin-vue-layouts
|
|
Layouts({
|
|
layoutsDir: 'src/layouts',
|
|
defaultLayout: 'Default'
|
|
}),
|
|
|
|
// https://github.com/antfu/unplugin-auto-import
|
|
AutoImport({
|
|
include: [
|
|
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
|
|
/\.vue$/, /\.vue\?vue/, // .vue
|
|
/\.md$/, // .md
|
|
],
|
|
imports: [
|
|
'vue',
|
|
'vue-router',
|
|
'vue-i18n',
|
|
'vuex',
|
|
'@vueuse/head',
|
|
'@vueuse/core',
|
|
],
|
|
dts: true,
|
|
}),
|
|
|
|
// https://github.com/antfu/vite-plugin-components
|
|
Components({
|
|
// allow auto load markdown components under `./src/components/`
|
|
extensions: ['vue', 'md'],
|
|
resolvers: [
|
|
// auto import icons
|
|
// https://github.com/antfu/vite-plugin-icons
|
|
IconsResolver({
|
|
componentPrefix: '',
|
|
enabledCollections: ['carbon'],
|
|
}),
|
|
],
|
|
// allow auto import and register components used in markdown
|
|
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
|
|
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/**')],
|
|
}),
|
|
// https://github.com/antfu/vite-plugin-md
|
|
Markdown({
|
|
}),
|
|
// https://github.com/antfu/vite-plugin-inspect
|
|
Inspect({
|
|
// change this to enable inspect for debugging
|
|
enabled: false,
|
|
}),
|
|
],
|
|
|
|
server: {
|
|
fs: {
|
|
strict: true,
|
|
},
|
|
},
|
|
build: {
|
|
sourcemap: false,
|
|
},
|
|
optimizeDeps: {
|
|
include: [
|
|
'vue',
|
|
'vue-router',
|
|
'@vueuse/core',
|
|
'@vueuse/head',
|
|
],
|
|
exclude: [
|
|
'vue-demi',
|
|
],
|
|
},
|
|
})
|