Skip to content

Commit 3e0eb57

Browse files
committed
see if this speeds up things
1 parent 9f7ad72 commit 3e0eb57

File tree

1 file changed

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

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { ready } from '../common/index.js';
66
let vm;
77
/** @type {Promise<import('$lib/types').Adapter> | undefined} */
88
let instance;
9+
/** @type {Map<string, string>} latest contents of some special files for comparison */
10+
const file_contents = new Map();
911

1012
/**
1113
* @param {import('$lib/types').Stub[]} stubs
@@ -192,10 +194,12 @@ async function _create(stubs) {
192194
}
193195
}
194196

195-
await vm.loadFiles(convert_stubs_to_tree(stubs));
197+
stubs = stubs.filter(
198+
(stub) => stub.type !== 'file' || file_contents.get(stub.name) !== stub.contents
199+
);
196200

201+
await vm.loadFiles(convert_stubs_to_tree(stubs));
197202
await promise;
198-
199203
await new Promise((f) => setTimeout(f, 200)); // wait for chokidar
200204

201205
resolve();

0 commit comments

Comments
 (0)