Skip to content

Commit 4c3f45a

Browse files
committed
[fix] don't reinit when vm already booted
1 parent 32c8885 commit 4c3f45a

File tree

1 file changed

+6
-4
lines changed
  • src/lib/client/adapters/webcontainer

1 file changed

+6
-4
lines changed

src/lib/client/adapters/webcontainer/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ export async function create(stubs) {
2929
reject(new Error('Timed out starting WebContainer'));
3030
}, 15000);
3131

32-
console.log('loading webcontainer');
32+
if (!vm) {
33+
console.log('loading webcontainer');
3334

34-
const WebContainer = await load();
35+
const WebContainer = await load();
3536

36-
console.log('booting webcontainer');
37+
console.log('booting webcontainer');
3738

38-
vm = await WebContainer.boot();
39+
vm = await WebContainer.boot();
40+
}
3941

4042
const error_unsub = vm.on('error', (error) => {
4143
error_unsub();

0 commit comments

Comments
 (0)