Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module - electron-webpack #26

Open
theCele opened this issue Nov 11, 2020 · 1 comment
Open

Error: Cannot find module - electron-webpack #26

theCele opened this issue Nov 11, 2020 · 1 comment
Labels
question Further information is requested

Comments

@theCele
Copy link

theCele commented Nov 11, 2020

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

  1. Added "target": "esnext" to tsconfig.json

  2. Added threads-plugin to webpack.main.additions.js and webpack.renderer.additions.js

  3. Added "whiteListedModules": ["threads"] to package.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?

@andywer
Copy link
Owner

andywer commented Nov 16, 2020

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?

@andywer andywer added the question Further information is requested label Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants