mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-11-17 22:23:42 +08:00
chore: migrate to farm
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import type { PluginOption } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx';
|
||||
import unocss from '@unocss/vite';
|
||||
import progress from 'vite-plugin-progress';
|
||||
import VueDevtools from 'vite-plugin-vue-devtools';
|
||||
// import unocss from '@unocss/vite';
|
||||
// import progress from 'vite-plugin-progress';
|
||||
// import VueDevtools from 'vite-plugin-vue-devtools';
|
||||
import pageRoute from '@soybeanjs/vite-plugin-vue-page-route';
|
||||
import unplugin from './unplugin';
|
||||
import mock from './mock';
|
||||
@@ -17,20 +17,28 @@ import pwa from './pwa';
|
||||
*/
|
||||
export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | PluginOption[])[] {
|
||||
const plugins = [
|
||||
vue({
|
||||
script: {
|
||||
defineModel: true
|
||||
}
|
||||
() => ({
|
||||
vitePlugin: vue({
|
||||
script: {
|
||||
defineModel: true
|
||||
}
|
||||
}),
|
||||
filters: ['\\.vue$', '\\\\0.+']
|
||||
}),
|
||||
vueJsx(),
|
||||
VueDevtools(),
|
||||
() => ({
|
||||
vitePlugin: vueJsx(),
|
||||
filters: ['\\.vue$', '\\\\0.+']
|
||||
}),
|
||||
// VueDevtools(),
|
||||
...unplugin(viteEnv),
|
||||
unocss(),
|
||||
mock(viteEnv),
|
||||
progress()
|
||||
// unocss(),
|
||||
mock(viteEnv)
|
||||
// progress()
|
||||
];
|
||||
|
||||
if (viteEnv.VITE_VISUALIZER === 'Y') {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
plugins.push(visualizer as PluginOption);
|
||||
}
|
||||
if (viteEnv.VITE_COMPRESS === 'Y') {
|
||||
@@ -42,6 +50,7 @@ export function setupVitePlugins(viteEnv: ImportMetaEnv): (PluginOption | Plugin
|
||||
if (viteEnv.VITE_SOYBEAN_ROUTE_PLUGIN === 'Y') {
|
||||
plugins.push(pageRoute());
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
return plugins;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import Icons from 'unplugin-icons/vite';
|
||||
import IconsResolver from 'unplugin-icons/resolver';
|
||||
import Components from 'unplugin-vue-components/vite';
|
||||
import Components from 'unplugin-vue-components/rollup';
|
||||
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
|
||||
import { FileSystemIconLoader } from 'unplugin-icons/loaders';
|
||||
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
||||
// import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
|
||||
import { getSrcPath } from '../utils';
|
||||
|
||||
export default function unplugin(viteEnv: ImportMetaEnv) {
|
||||
@@ -33,12 +33,12 @@ export default function unplugin(viteEnv: ImportMetaEnv) {
|
||||
NaiveUiResolver(),
|
||||
IconsResolver({ customCollections: [collectionName], componentPrefix: VITE_ICON_PREFIX })
|
||||
]
|
||||
}),
|
||||
createSvgIconsPlugin({
|
||||
iconDirs: [localIconPath],
|
||||
symbolId: `${VITE_ICON_LOCAL_PREFIX}-[dir]-[name]`,
|
||||
inject: 'body-last',
|
||||
customDomId: '__SVG_ICON_LOCAL__'
|
||||
})
|
||||
// createSvgIconsPlugin({
|
||||
// iconDirs: [localIconPath],
|
||||
// symbolId: `${VITE_ICON_LOCAL_PREFIX}-[dir]-[name]`,
|
||||
// inject: 'body-last',
|
||||
// customDomId: '__SVG_ICON_LOCAL__'
|
||||
// })
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user