Created
September 5, 2019 14:22
-
-
Save Nazar32/de20d2fae38248532be1855d50409564 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const chokidar = require('chokidar'); | |
| const watcher = chokidar.watch('.', { | |
| ignored: '/\\.(png|jpg|gif|svg)$/', | |
| }); | |
| watcher.on('ready', () => { | |
| console.log('ready'); | |
| watcher.on('all', (event, path) => { | |
| console.log(`all ${path}`); | |
| Object.keys(require.cache).forEach((id) => { | |
| delete require.cache[id]; | |
| if (/[\/\\]dist[\/\\]/.test(id) && delete require.cache[id]) { | |
| console.log(`Clearing ${id} module cache`); | |
| } | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment