Error: Cannot find module - electron-webpack
I am trying to make it work threads-plugin with electron-webpack. I have the example here https://github.com/theCele/electron-webpack-thread
By the way - it works great for JS, only when the files are typescript I don't see the bundle.worker.js in the dist/main folder.
(node:14980) UnhandledPromiseRejectionWarning: Error: Cannot find module 'D:\dev\electron-webpack-thread\dist\main\child'
Require stack:
- D:\dev\electron-webpack-thread\dist\main\main.js
- D:\dev\electron-webpack-thread\node_modules\electron\dist\resources\default_app.asar\main.js
-
at Module._resolveFilename (internal/modules/cjs/loader.js:961:15)
at Function.o._resolveFilename (electron/js2c/browser_init.js:257:921)
at Function.resolve (internal/modules/cjs/helpers.js:83:19)
at resolveScriptPath (webpack-internal:///./node_modules/threads/dist-esm/master/implementation.node.js:70:19)
at new Worker (webpack-internal:///./node_modules/threads/dist-esm/master/implementation.node.js:84:19)
at Object.exports.runner (webpack-internal:///./src/main/parent.ts:6:43)
at createMainWindow (webpack-internal:///./src/main/index.ts:58:14)
at App.eval (webpack-internal:///./src/main/index.ts:76:18)
at App.emit (events.js:310:20)
I have followed all instructions. Not sure what I do wrong
-
Added
"target": "esnext"totsconfig.json -
Added
threads-plugintowebpack.main.additions.jsandwebpack.renderer.additions.js -
Added
"whiteListedModules": ["threads"]topackage.json
I've lost days looking around but couldn't find a solution. Also, I'm not sure if it is electron-webpack or threads-plugin issue.
Could you please have a look at my implementation? What do you think cases this TypeScript issue?
Sorry for the late reply, @theCele! Might be related to #29, not sure.
Can you try the small fix I proposed there? Another quick guess: Maybe webpack's resolve.extensions is not yet set to include *.ts/*.tsx files?