chore: fix for makdown

This commit is contained in:
Jesús Pérez Lorenzo 2021-10-19 21:44:41 +01:00
parent f50a02666e
commit d18168910e

View File

@ -10,6 +10,8 @@ import Components from 'unplugin-vue-components/vite'
import WindiCSS from 'vite-plugin-windicss' import WindiCSS from 'vite-plugin-windicss'
import AutoImport from 'unplugin-auto-import/vite' import AutoImport from 'unplugin-auto-import/vite'
import VueI18n from '@intlify/vite-plugin-vue-i18n' import VueI18n from '@intlify/vite-plugin-vue-i18n'
import Markdown from 'vite-plugin-md'
import Inspect from 'vite-plugin-inspect'
export default defineConfig({ export default defineConfig({
resolve: { resolve: {
@ -19,10 +21,14 @@ export default defineConfig({
}, },
}, },
plugins: [ plugins: [
Vue(), Vue({
include: [/\.vue$/, /\.md$/], // <--
}),
// https://github.com/hannoeru/vite-plugin-pages // https://github.com/hannoeru/vite-plugin-pages
Pages(), Pages({
extensions: ['vue', 'md'],
}),
imagetools(), imagetools(),
// https://github.com/JohnCampionJr/vite-plugin-vue-layouts // https://github.com/JohnCampionJr/vite-plugin-vue-layouts
Layouts({ Layouts({
@ -32,10 +38,16 @@ export default defineConfig({
// https://github.com/antfu/unplugin-auto-import // https://github.com/antfu/unplugin-auto-import
AutoImport({ AutoImport({
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue$/, /\.vue\?vue/, // .vue
/\.md$/, // .md
],
imports: [ imports: [
'vue', 'vue',
'vue-router', 'vue-router',
'vue-i18n', 'vue-i18n',
'vuex',
'@vueuse/head', '@vueuse/head',
'@vueuse/core', '@vueuse/core',
], ],
@ -44,6 +56,8 @@ export default defineConfig({
// https://github.com/antfu/vite-plugin-components // https://github.com/antfu/vite-plugin-components
Components({ Components({
// allow auto load markdown components under `./src/components/`
extensions: ['vue', 'md'],
resolvers: [ resolvers: [
// auto import icons // auto import icons
// https://github.com/antfu/vite-plugin-icons // https://github.com/antfu/vite-plugin-icons
@ -52,6 +66,8 @@ export default defineConfig({
enabledCollections: ['carbon'], enabledCollections: ['carbon'],
}), }),
], ],
// allow auto import and register components used in markdown
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
dts: true, dts: true,
}), }),
@ -67,6 +83,14 @@ export default defineConfig({
runtimeOnly: true, runtimeOnly: true,
compositionOnly: true, compositionOnly: true,
include: [path.resolve(__dirname, 'locales/**')], 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,
}), }),
], ],
@ -75,7 +99,9 @@ export default defineConfig({
strict: true, strict: true,
}, },
}, },
build: {
sourcemap: false,
},
optimizeDeps: { optimizeDeps: {
include: [ include: [
'vue', 'vue',