bennymeg / nx-electron

Electron schematics for nrwl nx platform
Apache License 2.0
309 stars 82 forks source link

Can't resolve main.preload.ts' #222

Closed voronindenis closed 9 months ago

voronindenis commented 1 year ago

Describe the bug Webpack 5.75.0 compiled with 1 error after installing and intitailzation electron.

Error message: " ERROR in main.preload

Module not found: Error: Can't resolve 'apps/icc-front-electron/src/app/api/main.preload.ts' in '/Users/denisvoronin/Documents/dev/icc-front-monorepo'

Did you mean './apps/icc-front-electron/src/app/api/main.preload.ts'?

Requests that should resolve in the current directory need to start with './'.

Requests that start with a name are treated as module requests and resolve within module directories (node_modules).

If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.

resolve 'apps/icc-front-electron/src/app/api/main.preload.ts' in '/Users/denisvoronin/Documents/dev/icc-front-monorepo' "

To Reproduce Steps to reproduce the behavior:

  1. Update nx from 15.8.5 to 15.9.2
  2. Install nx-electron 15.0.0
  3. Init electron app on ready react app via nx g nx-electron:app <electron-app-name> --frontendProject=<frontend-app-name>
  4. Press Enter on the question: "In which directory should the electron application be generated?"
  5. Serve app via nx build <electron-app-name>

Expected behavior Webpack 5.75.0 compiled without errors

Desktop (please complete the following information):

bennymeg commented 10 months ago

Could you please update the library to the latest v15 and try again?

arkadevbanerjee commented 5 months ago

@bennymeg I think this PR https://github.com/bennymeg/nx-electron/pull/277 should solve this Problem. I was facing the same issue