Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
fix: don't reload not required modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Sep 28, 2019
1 parent 9d1d4ba commit fb85dc0
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions bin/watch/restart-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,9 @@ module.exports = ({ spinner, filepath, pkg, cwd, cli, watchFiles, port, watcher,

// Remove file that changed from the `require` cache
for (const item of toDelete) {
let location

try {
location = require.resolve(item)
} catch (err) {
continue
}

clearModule(location)
// discard items not required before
if (!require.cache[item]) continue
clearModule(item)
}

// Restart the server
Expand Down

0 comments on commit fb85dc0

Please sign in to comment.