Skip to content

Commit

Permalink
fix(server-assets): assets behavior (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz authored Apr 13, 2022
1 parent b77ef27 commit e21134c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/rollup/plugins/server-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const serverAssets = ${JSON.stringify(nitro.options.serverAssets)}
export const assets = createStorage()
for (const asset of serverAssets) {
assets.mount(asset.base, fsDriver({ base: asset.dir }))
assets.mount(asset.baseName, fsDriver({ base: asset.dir }))
}`
}

Expand All @@ -84,19 +84,19 @@ ${normalizeKey.toString()}
export const assets = {
getKeys() {
return Object.keys(_assets)
return Promise.resolve(Object.keys(_assets))
},
hasItem (id) {
id = normalizeKey(id)
return id in _assets
return Promise.resolve(id in _assets)
},
getItem (id) {
id = normalizeKey(id)
return _assets[id] ? _assets[id].import() : null
return Promise.resolve(_assets[id] ? _assets[id].import() : null)
},
getMeta (id) {
id = normalizeKey(id)
return _assets[id] ? _assets[id].meta : {}
return Promise.resolve(_assets[id] ? _assets[id].meta : {})
}
}
`
Expand Down

0 comments on commit e21134c

Please sign in to comment.