Skip to content

Commit 0e3a91e

Browse files
committed
fix: check for snapshot file presence, fix #5
1 parent 9b3e5f7 commit 0e3a91e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/core/src/snapshot/addResourcesToSnapshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export async function addResourcesToSnapshot(mq: MoquerieInstance, options: AddR
2828
const resourceStorage = await getResourceInstanceStorage(mq, resourceName)
2929

3030
const ids = resourceIds[resourceName]
31-
const data: Record<string, any> = SuperJSON.parse(await fs.promises.readFile(targetFile, 'utf8'))
31+
const data: Record<string, any> = fs.existsSync(targetFile) ? SuperJSON.parse(await fs.promises.readFile(targetFile, 'utf8')) : {}
3232

3333
for (const id of ids) {
3434
const file = resourceStorage.manifest.files[id]

0 commit comments

Comments
 (0)