Skip to content

Commit 42fffc9

Browse files
committed
fix(module): do not warn when sources is empty
1 parent 138bb7d commit 42fffc9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ export function getMountDriver (mount: MountOptions) {
7373
export function useContentMounts (nuxt: Nuxt, storages: Array<string | MountOptions> | Record<string, MountOptions>) {
7474
const key = (path: string, prefix: string = '') => `${MOUNT_PREFIX}${path.replace(/[/:]/g, '_')}${prefix.replace(/\//g, ':')}`
7575

76+
const storageKeys = Object.keys(storages)
7677
if (
7778
Array.isArray(storages) ||
7879
// Detect object representation of array `{ '0': 'source1' }`. Nuxt converts this array to object when using `nuxt.config.ts`
79-
Object.keys(storages).every(i => i === String(+i))
80+
(storageKeys.length > 0 && storageKeys.every(i => i === String(+i)))
8081
) {
8182
storages = Object.values(storages)
8283
logger.warn('Using array syntax to define sources is deprecated. Consider using object syntax.')

0 commit comments

Comments
 (0)