Skip to content

Commit e085e30

Browse files
committed
fix: serialize import maps
closes #204
1 parent 8038b49 commit e085e30

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/store.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export class ReplStore implements Store {
318318
const files = this.getFiles()
319319
const importMap = files[importMapFile]
320320
if (importMap) {
321-
const { imports } = JSON.parse(importMap)
321+
const { imports, ...restImportMap } = JSON.parse(importMap)
322322
if (imports['vue'] === this.defaultVueRuntimeURL) {
323323
delete imports['vue']
324324
}
@@ -328,7 +328,11 @@ export class ReplStore implements Store {
328328
if (!Object.keys(imports).length) {
329329
delete files[importMapFile]
330330
} else {
331-
files[importMapFile] = JSON.stringify({ imports }, null, 2)
331+
files[importMapFile] = JSON.stringify(
332+
{ imports, ...restImportMap },
333+
null,
334+
2
335+
)
332336
}
333337
}
334338
return '#' + utoa(JSON.stringify(files))
@@ -400,7 +404,7 @@ export class ReplStore implements Store {
400404
)
401405
}
402406
map.code = JSON.stringify(json, null, 2)
403-
} catch (e) {}
407+
} catch {}
404408
}
405409
}
406410

0 commit comments

Comments
 (0)