2022-06-30

chokidar works in VS code debugger, but not able to load when Electron app is built

I am using chokidar to monitor file changes in directory. The following works if the app is started in VS code debugger.

const chokidar = require('chokidar');

But, after building the app, and start the app by clicking the app icon, it has following error in a popup dialog

Uncaught Exception:
Error: Cannot find module 'chokidar'

This is Electron and Electron-builder version:

electron-builder  version=22.13.1 os=20.2.0
writing effective config  file=dist/builder-effective-config.yaml
packaging       platform=darwin arch=x64 electron=11.5.0 appOutDir=dist/mac

How to solve it?



No comments:

Post a Comment