Skip to content

Commit

Permalink
fix: invalidate require cache on every request
Browse files Browse the repository at this point in the history
Enables live changes made in cartridges without restarting the playground.
  • Loading branch information
vysinsky committed Aug 2, 2022
1 parent a807c44 commit 0f202e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ const Module = require('module');

const app = express();

app.use((req, res, next) => {
Object.keys(require.cache).forEach(function (key) {
delete require.cache[key];
});

next();
});

app.use(express.static(path.join(__dirname, '..', '..', 'client', 'build')));

app.get('/api/routes', (req, res, next) => {
Expand Down

0 comments on commit 0f202e1

Please sign in to comment.