Skip to content

Commit e66fe57

Browse files
committed
chore(silent): allow to silent the failed parse console.log
1 parent 4833c20 commit e66fe57

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { createComponentMetaCheckerByJsonConfig } from 'vue-component-meta'
1111
import type { HookData } from './types'
1212

1313
export interface ModuleOptions {
14+
silent?: boolean
1415
checkerOptions?: MetaCheckerOptions
1516
}
1617
export interface ModuleHooks {
@@ -23,6 +24,7 @@ export default defineNuxtModule<ModuleOptions>({
2324
configKey: 'componentMeta'
2425
},
2526
defaults: () => ({
27+
silent: true,
2628
checkerOptions: {
2729
forceUseTs: true,
2830
schema: {}
@@ -127,7 +129,7 @@ export default defineNuxtModule<ModuleOptions>({
127129
// @ts-ignore
128130
await nuxt.callHook('component-meta:parsed', data)
129131
} catch (error: any) {
130-
console.error(`Unable to parse component "${path}": ${error}`)
132+
!options?.silent && console.error(`Unable to parse component "${path}": ${error}`)
131133
}
132134

133135
return data.meta

0 commit comments

Comments
 (0)