Skip to content

Commit 262be83

Browse files
authored
fix: not to remove node_modules (sveltejs#204)
fix sveltejs#195 This is due to node_modules being removed when switching tutorials. This only happens when switching from one tutorial with its own node_modules to another.
1 parent 7f6d1d3 commit 262be83

File tree

1 file changed

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

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ export async function create(stubs, callback) {
138138
current_stubs.delete(stub.name);
139139
}
140140

141+
// Don't delete the node_modules folder when switching from one exercise to another
142+
// where, as this crashes the dev server.
143+
['/node_modules', '/node_modules/.bin'].forEach((name) => current_stubs.delete(name));
144+
141145
const to_delete = Array.from(current_stubs.keys());
142146
current_stubs = stubs_to_map(stubs);
143147

0 commit comments

Comments
 (0)