diff --git a/build/plugins/index.ts b/build/plugins/index.ts index 7476e0a..200540c 100644 --- a/build/plugins/index.ts +++ b/build/plugins/index.ts @@ -1,7 +1,7 @@ import vue from './vue'; import compress from './compress'; import html from './html'; -import unocss from './unocss'; +import unocss from '@unocss/vite'; import visualizer from './visualizer'; import unplugin from './unplugin'; import mock from './mock'; @@ -12,7 +12,7 @@ import mock from './mock'; * @return {*} */ export function setVitePlugins(env: ImportMetaEnv) { - const plugins = [...vue, html(env), unocss, ...unplugin, mock]; + const plugins = [...vue, html(env), unocss(), ...unplugin, mock]; // 是否压缩 if (env.VITE_COMPRESS_OPEN === 'Y') { plugins.push(compress(env)); diff --git a/build/plugins/unocss.ts b/build/plugins/unocss.ts deleted file mode 100644 index 06b7cc9..0000000 --- a/build/plugins/unocss.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Unocss from 'unocss/vite'; // https://github.com/unocss/unocss - -export default Unocss(); diff --git a/package.json b/package.json index e7301fc..fd7b029 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,9 @@ "@types/node": "^18.7.13", "@typescript-eslint/eslint-plugin": "^5.35.1", "@typescript-eslint/parser": "^5.35.1", + "@unocss/preset-attributify": "^0.45.18", + "@unocss/preset-uno": "^0.45.18", + "@unocss/vite": "^0.45.18", "@vitejs/plugin-vue": "^3.0.3", "@vitejs/plugin-vue-jsx": "^2.0.0", "@vue/eslint-config-prettier": "^7.0.0", @@ -60,7 +63,6 @@ "prettier": "^2.7.1", "rollup-plugin-visualizer": "^5.8.0", "typescript": "^4.7.4", - "unocss": "^0.45.12", "unplugin-icons": "^0.14.8", "unplugin-vue-components": "^0.22.4", "vite": "^3.0.9", diff --git a/unocss.config.ts b/unocss.config.ts index 922bf11..c8d8e92 100644 --- a/unocss.config.ts +++ b/unocss.config.ts @@ -1,6 +1,9 @@ -import { defineConfig, presetUno, presetAttributify, presetIcons } from 'unocss'; // https://github.com/unocss/unocss +import { defineConfig } from '@unocss/vite'; // https://github.com/unocss/unocss +import presetUno from '@unocss/preset-uno'; +import presetAttributify from '@unocss/preset-attributify'; + export default defineConfig({ - presets: [presetUno({ dark: 'class' }), presetAttributify(), presetIcons()], + presets: [presetUno({ dark: 'class' }), presetAttributify()], shortcuts: { 'wh-full': 'w-full h-full', 'flex-center': 'flex justify-center items-center',