Skip to content

Commit 7df5faf

Browse files
committed
fix: prevent exercise-specific deps from being deleted
1 parent 6736ff7 commit 7df5faf

File tree

1 file changed

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

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@ export async function create(base, error, progress, logs) {
138138

139139
// Don't delete the node_modules folder when switching from one exercise to another
140140
// where, as this crashes the dev server.
141-
['/node_modules', '/node_modules/.bin'].forEach((name) => current_stubs.delete(name));
141+
const to_delete = Array.from(current_stubs.keys()).filter(
142+
(s) => !s.startsWith('/node_modules')
143+
);
142144

143-
const to_delete = Array.from(current_stubs.keys());
144145
current_stubs = stubs_to_map(stubs);
145146

146147
// For some reason, server-ready is fired again when the vite dev server is restarted.

0 commit comments

Comments
 (0)