Answer the question
In order to leave comments, you need to log in
Electron+Webpack = Module not found: Error: Can't resolve fsevents/fs/etc in chokidar/etc ???
Hello.
I'm trying to write an app using Electron + Webpack.
I found that many libraries cause an error like Module not found: Error: Can't resolve ...
For example, the chokidar
.
webpack.config.js
const path = require('path')
module.exports = {
mode: 'development',
target: `electron-main`,
entry: {main: `./src/main.js`},
resolve: {
extensions: ['.js'],
modules: ['node_modules', path.join(__dirname, 'src')],
},
output: {
path: path.resolve(__dirname, `dist`),
filename: '[name].bundle.js',
},
}
const watcher = require('chokidar').watch('./dist')
watcher.on('change', function() {
console.log('change', arguments)
})
{
"name": "test",
"version": "1.0.0",
"author": "I",
"private": true,
"main": "dist/main.bundle.js",
"scripts": {
"build": "webpack"
},
"devDependencies": {
"@types/chokidar": "^1.7.5",
"chokidar": "^2.0.4",
"electron": "^2.0.8",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0"
}
}
WARNING in ./node_modules/chokidar/lib/fsevents-handler.js
Module not found: Error: Can't resolve 'fsevents' in '.\node_modules\chokidar\lib'
@ ./node_modules/chokidar/lib/fsevents-handler .js
@ ./node_modules/chokidar/index.js
@ ./src/main.js
node: { fsevents: 'empty' }
doesn't help.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question