Skip to content

Commit

Permalink
fix: fix setFiles with multi files cross imports
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Sep 10, 2021
1 parent f8bb46f commit 424e00d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,17 @@ export class ReplStore {
return exported
}

setFiles(newFiles: Record<string, string>) {
async setFiles(newFiles: Record<string, string>) {
const files: Record<string, File> = {}
for (const filename in newFiles) {
files[filename] = new File(filename, newFiles[filename])
}
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)
Expand Down

0 comments on commit 424e00d

Please sign in to comment.