File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,9 @@ export default createUnplugin<Partial<PluginOptions> | undefined>((userOptions =
52
52
Object . keys ( opts . collections )
53
53
. map ( prefix => [
54
54
prefix ,
55
- resolve ( opts . cwd , opts . output , `${ prefix } .json` ) ,
55
+ isAbsolute ( opts . output )
56
+ ? resolve ( opts . output , `${ prefix } .json` )
57
+ : resolve ( opts . cwd , opts . output , `${ prefix } .json` ) ,
56
58
] ) ,
57
59
)
58
60
@@ -91,11 +93,19 @@ export default createUnplugin<Partial<PluginOptions> | undefined>((userOptions =
91
93
)
92
94
}
93
95
96
+ async function clearOutputDir ( ) {
97
+ const outputDir = isAbsolute ( opts . output ) ? opts . output : resolve ( opts . cwd , opts . output )
98
+ const isExistOutputDir = await fs . pathExists ( outputDir )
99
+ isExistOutputDir && await fs . emptyDir ( outputDir )
100
+ }
101
+
94
102
let watcher : FSWatcher
95
103
96
104
return {
97
105
name : 'unplugin-iconify-generator' ,
98
106
async buildStart ( ) {
107
+ await clearOutputDir ( )
108
+
99
109
/**
100
110
* antfu.iconify cannot fsWatch a nonexistent file
101
111
* so create empty iconifyJSON files first, then update vscode settings
You can’t perform that action at this time.
0 commit comments