You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

46 lines
1.4 KiB

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vuejsx from '@vitejs/plugin-vue-jsx'
import Components from 'unplugin-vue-components/vite'
import * as _ from 'lodash'
import fs from 'fs-extra'
import * as path from 'path'
import WindiCSS from 'vite-plugin-windicss'
function exist(p) {
return fs.existsSync(
path.resolve(__dirname, '../theme-chalk/src/' + p + '.scss')
)
}
// https://vitejs.dev/config/
export default defineConfig({
build:{
sourcemap: true
},
plugins: [
vue(),
vuejsx(),
WindiCSS(),
Components({
dts: true,
resolvers: [
{
type: 'component',
resolve: (componentName: string) => {
if (componentName.startsWith('Ps')) {
const name = _.lowerFirst(componentName.slice(2))
return {
name: componentName,
from: `@princess-ui/components/${name}`,
sideEffects: exist(name)
? `@princess-ui/theme-chalk/src/${name}.scss`
: undefined,
}
}
},
},
],
}),
],
})