1- import { readdirSync , copyFileSync } from "fs" ;
1+ import { readdirSync , copyFileSync , mkdirSync } from "fs" ;
22import { build , defineConfig } from "vite" ;
33import vue from "@vitejs/plugin-vue" ;
44import dts from "vite-plugin-dts" ;
5+ import { copyDirSync , deleteFolderRecursive } from "./utiles" ;
56
67const DefineOptions = require ( "unplugin-vue-define-options/vite" ) ;
78const path = require ( "path" ) ;
@@ -41,17 +42,22 @@ async function main() {
4142 } ) ,
4243 ] ,
4344 build : {
44- commonjsOptions : {
45- include : [ / d o c s / , / n o d e _ m o d u l e s / , / p l a y / ] ,
46- } ,
4745 lib : {
4846 entry,
4947 name : "licht-ui" ,
5048 fileName : ( format : any ) => `index.${ format } .js` ,
51- formats : [ "cjs" , " es", "umd" ] ,
49+ formats : [ "es" , "umd" ] ,
5250 } ,
5351 outDir : packageOutDir ,
5452 emptyOutDir : true ,
53+ chunkSizeWarningLimit : 1500 ,
54+ terserOptions : {
55+ compress : {
56+ drop_console : true ,
57+
58+ drop_debugger : true ,
59+ } ,
60+ } ,
5561 rollupOptions : {
5662 external : [ "vue" ] ,
5763 output : {
@@ -68,6 +74,12 @@ async function main() {
6874 resolve ( packageRoot + "/package.json" ) ,
6975 resolve ( `./${ buildDir } /${ i } /package.json` )
7076 ) ;
77+ mkdirSync ( resolve ( `./${ buildDir } /style` ) , { recursive : true } ) ;
78+ copyDirSync (
79+ resolve ( `${ packageOutDir } /style` ) ,
80+ resolve ( `./${ buildDir } /style` )
81+ ) ;
82+ deleteFolderRecursive ( resolve ( `${ packageOutDir } /style` ) ) ;
7183 }
7284}
7385main ( ) ;
0 commit comments