chore: add fixes for components discovery

This commit is contained in:
Pooya Parsa 2021-06-18 18:57:42 +02:00
parent a0f81cd1fb
commit 36a3d285d8
2 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,8 @@ import { scanComponents } from './scan'
import type { ComponentsDir } from './types'
const isPureObjectOrString = (val: any) => (!Array.isArray(val) && typeof val === 'object') || typeof val === 'string'
const getDir = (p: string) => fs.statSync(p).isDirectory() ? p : dirname(p)
const isDirectory = (p: string) => { try { return fs.statSync(p).isDirectory() } catch (_e) { return false } }
const getDir = (p: string) => isDirectory(p) ? p : dirname(p)
export default defineNuxtModule({
name: 'components',

View File

@ -1,6 +1,6 @@
<template>
<div>
<HelloWorld />
Hello World
</div>
</template>