-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
60 lines (57 loc) · 1.88 KB
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { defineConfig } from "vite"
import React from "@vitejs/plugin-react"
import UnoCss from "unocss/vite"
import presetAttributify from "unocss/preset-attributify"
import presetIcons from "unocss/preset-icons"
import presetUno from "unocss/preset-uno"
// import transformerAttributifyJsx from '@unocss/transformer-attributify-jsx'
//ts error in this transform https://github.com/unocss/unocss/issues/2429
import transformerAttributifyJsx from "@unocss/transformer-attributify-jsx-babel"
import unoStyle from "./src/styles/unoStyle"
import transformerCompileClass from "@unocss/transformer-compile-class"
import path from "path"
export default defineConfig({
plugins: [
UnoCss({
presets: [
presetUno(),
presetAttributify({
prefix: "uno-",
// prefixedOnly:true // strict prefix toogler
}),
presetIcons({
extraProperties: {
display: "inline-block",
"vertical-align": "middle",
},
}),
],
shortcuts: [
{
...unoStyle,
"n-action": "pointer-events-none",
},
],
transformers: [
//@ts-ignore
transformerCompileClass(),
transformerAttributifyJsx(), // <--
],
}),
React(), // order matters when we use presetAttributify with React
/**
* If you're using @unocss/preset-attributify you should remove tsc from the build script.
If you are using @vitejs/plugin-react with @unocss/preset-attributify,
you must add the plugin 'UnoCss' before @vitejs/plugin-react 'React'.
* */
],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
"@components": path.resolve(__dirname, "src/components"),
"@pages": path.resolve(__dirname, "src/pages"),
"@assets": path.resolve(__dirname, "src/assets"),
"@styles": path.resolve(__dirname, "src/styles"),
},
},
})