This commit is contained in:
108
vite.config.ts
108
vite.config.ts
@ -24,58 +24,7 @@ export default defineConfig(({ mode, command }) => {
|
||||
|
||||
return {
|
||||
base: env.VITE_BASE,
|
||||
plugins: [
|
||||
VueRouter({
|
||||
// https://uvr.esm.is/guide/configuration.html
|
||||
exclude: ['**/__*', '**/__*/**/*'],
|
||||
getRouteName: (routeNode) => getPascalCaseRouteName(routeNode),
|
||||
logs: false,
|
||||
extensions: ['.vue', '.page.vue', '.md'],
|
||||
}),
|
||||
// other plugins
|
||||
AutoImport({
|
||||
resolvers: [
|
||||
TDesignResolver({
|
||||
library: 'mobile-vue',
|
||||
esm: true,
|
||||
}),
|
||||
VantResolver({
|
||||
importStyle: true,
|
||||
}),
|
||||
],
|
||||
imports: ['pinia', 'vue', VueRouterAutoImports, unheadVueComposablesImports],
|
||||
}),
|
||||
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$/],
|
||||
resolvers: [
|
||||
TDesignResolver({
|
||||
library: 'mobile-vue',
|
||||
esm: true,
|
||||
}),
|
||||
VantResolver({
|
||||
importStyle: true,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
UnoCSS(),
|
||||
Vue({
|
||||
include: [/\.vue$/, /\.md$/], // <-- allows Vue to compile Markdown files
|
||||
}),
|
||||
vueJsx(),
|
||||
Markdown({
|
||||
headEnabled: true,
|
||||
}),
|
||||
vueDevTools(),
|
||||
cdnImport({
|
||||
// https://github.com/mmf-fe/vite-plugin-cdn-import/blob/HEAD/README.zh-CN.md
|
||||
modules: ['vue'],
|
||||
prodUrl: '//fastly.jsdelivr.net/npm/{name}@{version}/{path}',
|
||||
enableInDevMode: true,
|
||||
}),
|
||||
],
|
||||
plugins: Plugins(),
|
||||
define: {
|
||||
$__DEV__: JSON.stringify(!isBuild),
|
||||
},
|
||||
@ -127,3 +76,58 @@ function isInNodeModules(id: string): boolean {
|
||||
}
|
||||
/* const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
|
||||
const isCSSRequest = (request: string): boolean => CSS_LANGS_RE.test(request); */
|
||||
|
||||
function Plugins() {
|
||||
return [
|
||||
VueRouter({
|
||||
// https://uvr.esm.is/guide/configuration.html
|
||||
exclude: ['**/__*', '**/__*/**/*'],
|
||||
getRouteName: (routeNode) => getPascalCaseRouteName(routeNode),
|
||||
logs: false,
|
||||
extensions: ['.vue', '.page.vue', '.md'],
|
||||
}),
|
||||
// other plugins
|
||||
AutoImport({
|
||||
resolvers: [
|
||||
TDesignResolver({
|
||||
library: 'mobile-vue',
|
||||
esm: true,
|
||||
}),
|
||||
VantResolver({
|
||||
importStyle: true,
|
||||
}),
|
||||
],
|
||||
imports: ['pinia', 'vue', VueRouterAutoImports, unheadVueComposablesImports],
|
||||
}),
|
||||
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$/],
|
||||
resolvers: [
|
||||
TDesignResolver({
|
||||
library: 'mobile-vue',
|
||||
esm: true,
|
||||
}),
|
||||
VantResolver({
|
||||
importStyle: true,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
UnoCSS(),
|
||||
Vue({
|
||||
include: [/\.vue$/, /\.md$/], // <-- allows Vue to compile Markdown files
|
||||
}),
|
||||
vueJsx(),
|
||||
Markdown({
|
||||
headEnabled: true,
|
||||
}),
|
||||
vueDevTools(),
|
||||
cdnImport({
|
||||
// https://github.com/mmf-fe/vite-plugin-cdn-import/blob/HEAD/README.zh-CN.md
|
||||
modules: ['vue'],
|
||||
prodUrl: '//fastly.jsdelivr.net/npm/{name}@{version}/{path}',
|
||||
enableInDevMode: true,
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user