From 424e00d2ac50636b3a2a9739620435b156f1a94a Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 10 Sep 2021 18:20:50 -0400 Subject: [PATCH] fix: fix setFiles with multi files cross imports --- src/store.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/store.ts b/src/store.ts index 18fc1723..92913c3c 100644 --- a/src/store.ts +++ b/src/store.ts @@ -114,7 +114,7 @@ export class ReplStore { return exported } - setFiles(newFiles: Record) { + async setFiles(newFiles: Record) { const files: Record = {} for (const filename in newFiles) { files[filename] = new File(filename, newFiles[filename]) @@ -122,6 +122,9 @@ export class ReplStore { if (!files[MAIN_FILE]) { files[MAIN_FILE] = new File('App.vue', welcomeCode) } + for (const file in files) { + await compileFile(this, files[file]) + } this.state.files = files this.initImportMap() this.setActive(MAIN_FILE)