Fix node.js and webpack high CPU usage on macOS

2019-06-07 07:56:54 -0400

Option 1: chokidar

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.

Option 2: fsevents

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
«Newer      Older»
Comment:
Name:

Back to home

Subscribe | Register | Login | N