Adding chokidar
will fix the high CPU usage.
yarn add --dev chokidar
or if you use npm:
npm install --save-dev chokidar
(Don't forget to restart your node application.)
The module chokidar
is a neat wrapper around node.js fs.watch / fs.watchFile / FSEvents, providing high performance file watching by using OS-specific file event API and/or node's fs module. The webpack dev server uses it to detect file changes.
On macOS it uses FSEvents, a high performance file system event API.
Alternatively, if you don't want chokidar
, you can install fsevents
. But you will probably want --optional
because it is macOS only.
yarn add --dev fsevents --optional
or if you use npm:
npm install --save-dev fsevents