11import { createUnplugin } from 'unplugin'
22import { useComponentMetaParser } from '../parser/meta-parser'
3- import type { ComponentMetaParser , ComponentMetaParserOptions } from '../parser/meta-parser' ;
3+ import type { ComponentMetaParser } from '../parser/meta-parser'
4+ import type { ComponentMetaParserOptions } from '../types/parser'
45
56type ComponentMetaUnpluginOptions = { parser ?: ComponentMetaParser , parserOptions : ComponentMetaParserOptions }
67
@@ -12,14 +13,14 @@ export const metaPlugin = createUnplugin<ComponentMetaUnpluginOptions>(({ parser
1213 return {
1314 name : 'vite-plugin-nuxt-component-meta' ,
1415 enforce : 'post' ,
15- buildStart ( ) {
16+ async buildStart ( ) {
1617 // avoid parsing meta twice in SSR
1718 if ( _configResolved ?. build . ssr ) {
1819 return
1920 }
2021
2122 instance ?. fetchComponents ( )
22- instance ?. updateOutput ( )
23+ await instance ?. updateOutput ( )
2324 } ,
2425 buildEnd ( ) {
2526 if ( ! _configResolved ?. env . DEV && _configResolved ?. env . PROD ) {
@@ -32,10 +33,10 @@ export const metaPlugin = createUnplugin<ComponentMetaUnpluginOptions>(({ parser
3233 configResolved ( config ) {
3334 _configResolved = config
3435 } ,
35- handleHotUpdate ( { file } ) {
36+ async handleHotUpdate ( { file } ) {
3637 if ( instance && Object . entries ( instance . components ) . some ( ( [ , comp ] : any ) => comp . fullPath === file ) ) {
3738 instance . fetchComponent ( file )
38- instance . updateOutput ( )
39+ await instance . updateOutput ( )
3940 }
4041 }
4142 }
0 commit comments