Skip to content

Commit

Permalink
chore: add fixes for components discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jun 18, 2021
1 parent a0f81cd commit 36a3d28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/components/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion playground/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<HelloWorld />
Hello World
</div>
</template>

Expand Down

0 comments on commit 36a3d28

Please sign in to comment.