fix: unocss 不生效的问题
This commit is contained in:
14
bin/build.ts
14
bin/build.ts
@ -2,7 +2,7 @@
|
|||||||
* @Author: zhaojinfeng 121016171@qq.com
|
* @Author: zhaojinfeng 121016171@qq.com
|
||||||
* @Date: 2023-06-19 10:38:07
|
* @Date: 2023-06-19 10:38:07
|
||||||
* @LastEditors: zhaojinfeng 121016171@qq.com
|
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||||
* @LastEditTime: 2023-07-21 04:26:58
|
* @LastEditTime: 2023-07-21 14:47:27
|
||||||
* @FilePath: \vue3\bin\build.ts
|
* @FilePath: \vue3\bin\build.ts
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
@ -13,14 +13,15 @@ import { outputFile, readdir, remove } from 'fs-extra'
|
|||||||
import { build } from 'vite'
|
import { build } from 'vite'
|
||||||
import { renderFile } from 'ejs'
|
import { renderFile } from 'ejs'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
|
import Unocss from 'unocss/vite'
|
||||||
|
|
||||||
function buildAComponent(name: string) {
|
async function buildAComponent(name: string) {
|
||||||
build({
|
await build({
|
||||||
build: {
|
build: {
|
||||||
outDir: `es/${name}`,
|
outDir: `es/${name}`,
|
||||||
lib: {
|
lib: {
|
||||||
name: 'tianheng-design',
|
name: 'thzxcx',
|
||||||
entry: resolve(process.cwd(), 'packages', name, 'index.vue'),
|
entry: [resolve(process.cwd(), 'packages', name, 'index.vue'), resolve(process.cwd(), 'extra', 'unocss.ts')],
|
||||||
fileName: 'index',
|
fileName: 'index',
|
||||||
},
|
},
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
@ -39,7 +40,10 @@ function buildAComponent(name: string) {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
plugins: [Unocss()],
|
||||||
})
|
})
|
||||||
|
await Promise.all([remove(`es/${name}/index2.mjs`), remove(`es/${name}/unocss.mjs`), remove(`lib/${name}/index2.mjs`), remove(`lib/${name}/unocss.mjs`)])
|
||||||
|
consola.success(`${name}构建成功!`)
|
||||||
}
|
}
|
||||||
|
|
||||||
function dirPathToName(dirPath: string) {
|
function dirPathToName(dirPath: string) {
|
||||||
|
1
extra/unocss.ts
Normal file
1
extra/unocss.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
import 'uno.css'
|
Reference in New Issue
Block a user