build(deps): 更换unocss 为@unocss/vite,减小体积

This commit is contained in:
chen.home 2022-09-08 00:12:12 +08:00
parent 47b70dbc42
commit 393a267da8
4 changed files with 10 additions and 8 deletions

View File

@ -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));

View File

@ -1,3 +0,0 @@
import Unocss from 'unocss/vite'; // https://github.com/unocss/unocss
export default Unocss();

View File

@ -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",

View File

@ -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',