UNPKG

547 BJavaScriptView Raw
1const path = require('path')
2
3// We might cache something like poi config files
4// So we need to delete on a restart
5function deleteCache() {
6 // For now we only need to delete cache for package.json
7 // Since we use `export.readPkg()` which will cache it
8 // But we don't delete cache for files like `poi.config.js`
9 // Since they're never cached!
10 // See https://github.com/egoist/use-config/blob/c9c55952ca83106d11ca3353e1729a593d316ae5/index.js#L18-L24
11 delete require.cache[path.resolve('package.json')]
12}
13
14module.exports = deleteCache