@@ -13,6 +13,30 @@ import vue3SvgPlugin from 'vite-svg-loader'
1313import { getAlias , pathFromWorkspaceRoot , getOptimizeDeps } from '../../internals/cli/src/config/vite'
1414import virtualTemplatePlugin from '@opentiny-internal/unplugin-virtual-template/vite'
1515import tailwindCss from 'tailwindcss'
16+ import fg from 'fast-glob'
17+ import fs from 'fs-extra'
18+
19+ const delStatic = ( ) => {
20+ let config
21+ return {
22+ name : 'inline-plugin-del-static' ,
23+ apply : 'build' ,
24+ configResolved ( _config ) {
25+ config = _config
26+ } ,
27+ async closeBundle ( ) {
28+ const targetPath = path . join ( config . build . outDir , '@demos' )
29+ const files = await fg ( [ '**/*.spec.js' , '**/*.spec.ts' ] , {
30+ dot : true ,
31+ cwd : targetPath
32+ } )
33+ files . forEach ( ( filename ) => {
34+ const filePath = path . join ( targetPath , filename )
35+ fs . unlink ( filePath )
36+ } )
37+ }
38+ }
39+ }
1640
1741export default defineConfig ( ( config ) => {
1842 const env = loadEnv ( config . mode , process . cwd ( ) + '/env' , '' )
@@ -23,17 +47,17 @@ export default defineConfig((config) => {
2347 const menuPath = isSaas ? path . resolve ( './demos/saas' ) : path . resolve ( demosPath )
2448 const copyTarget = [
2549 {
26- src : `${ demosPath } /** ` ,
50+ src : `${ demosPath } /*` ,
2751 dest : '@demos'
2852 } ,
2953 {
30- src : `${ apisPath } /** ` ,
54+ src : `${ apisPath } /*` ,
3155 dest : '@demos/apis'
3256 }
3357 ]
3458 if ( isSaas ) {
3559 copyTarget . push ( {
36- src : `./demos/mobile-first/** ` ,
60+ src : `./demos/mobile-first/*` ,
3761 dest : '@demos/mobile-first'
3862 } )
3963 }
@@ -75,7 +99,8 @@ export default defineConfig((config) => {
7599 Unocss ( UnoCssConfig ) ,
76100 viteStaticCopy ( {
77101 targets : copyTarget
78- } )
102+ } ) ,
103+ delStatic ( )
79104 ] ,
80105 optimizeDeps : getOptimizeDeps ( 3 ) ,
81106 build : {
0 commit comments