Skip to content

Commit

Permalink
fix(module): multi-source array (#1578)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Oct 5, 2022
1 parent cb7679e commit b88b557
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ export function getMountDriver (mount: MountOptions) {
export function useContentMounts (nuxt: Nuxt, storages: Array<string | MountOptions> | Record<string, MountOptions>) {
const key = (path: string, prefix: string = '') => `${MOUNT_PREFIX}${path.replace(/[/:]/g, '_')}${prefix.replace(/\//g, ':')}`

if (Array.isArray(storages)) {
if (
Array.isArray(storages) ||
// Detect object representation of array `{ '0': 'source1' }`. Nuxt converts this array to object when using `nuxt.config.ts`
Object.keys(storages).every(i => i === String(+i))
) {
storages = Object.values(storages)
logger.warn('Using array syntax to define sources is deprecated. Consider using object syntax.')
storages = storages.reduce((mounts, storage) => {
if (typeof storage === 'string') {
Expand Down

0 comments on commit b88b557

Please sign in to comment.