@@ -13,6 +13,30 @@ import vue3SvgPlugin from 'vite-svg-loader'
13
13
import { getAlias , pathFromWorkspaceRoot , getOptimizeDeps } from '../../internals/cli/src/config/vite'
14
14
import virtualTemplatePlugin from '@opentiny-internal/unplugin-virtual-template/vite'
15
15
import 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
+ }
16
40
17
41
export default defineConfig ( ( config ) => {
18
42
const env = loadEnv ( config . mode , process . cwd ( ) + '/env' , '' )
@@ -23,17 +47,17 @@ export default defineConfig((config) => {
23
47
const menuPath = isSaas ? path . resolve ( './demos/saas' ) : path . resolve ( demosPath )
24
48
const copyTarget = [
25
49
{
26
- src : `${ demosPath } /** ` ,
50
+ src : `${ demosPath } /*` ,
27
51
dest : '@demos'
28
52
} ,
29
53
{
30
- src : `${ apisPath } /** ` ,
54
+ src : `${ apisPath } /*` ,
31
55
dest : '@demos/apis'
32
56
}
33
57
]
34
58
if ( isSaas ) {
35
59
copyTarget . push ( {
36
- src : `./demos/mobile-first/** ` ,
60
+ src : `./demos/mobile-first/*` ,
37
61
dest : '@demos/mobile-first'
38
62
} )
39
63
}
@@ -75,7 +99,8 @@ export default defineConfig((config) => {
75
99
Unocss ( UnoCssConfig ) ,
76
100
viteStaticCopy ( {
77
101
targets : copyTarget
78
- } )
102
+ } ) ,
103
+ delStatic ( )
79
104
] ,
80
105
optimizeDeps : getOptimizeDeps ( 3 ) ,
81
106
build : {
0 commit comments