minecraft-launcher-core-node icon indicating copy to clipboard operation
minecraft-launcher-core-node copied to clipboard

Module not found: Error: Can't resolve - Error

Open arajooj opened this issue 4 years ago • 3 comments

I'm having a problem when running the project with minecraft-launcher-core-node imports.

I'm using this repository as an initial template: https://github.com/maximegris/angular-electron

image

But just importing the packages and using a function already appears several errors

image

Does anyone know how to fix it? or if you have an electron + minecraft-launcher-core-node template ready to start?

arajooj avatar Apr 08 '21 06:04 arajooj

I guess these lines of code are in renderer process (browser).

You need to open nodeIntegration for that browser window to use node modules. (All missing modules are node modules)

But I suggest you to put the launch logic in main process.

Update:

After I investigated this ng template... It seems that the ng build system won't be able to require the node modules.

I even cannot use fs here. I suggest you to use react template or vue template.

image

For vue template, you can try this https://github.com/ci010/electron-vue-next

ci010 avatar Apr 08 '21 18:04 ci010

I guess these lines of code are in renderer process (browser).

You need to open nodeIntegration for that browser window to use node modules. (All missing modules are node modules)

But I suggest you to put the launch logic in main process.

Update:

After I investigated this ng template... It seems that the ng build system won't be able to require the node modules.

I even cannot use fs here. I suggest you to use react template or vue template.

image

For vue template, you can try this https://github.com/ci010/electron-vue-next

Thank you very much for your reply, and thanks for the link to the template in vue. Would there be any in React too?

arajooj avatar Apr 09 '21 19:04 arajooj

Thank you very much for your reply, and thanks for the link to the template in vue. Would there be any in React too?

That template actually will works with react. Vite use plugin to switch between different frameworks like vue, react, svelte, etc.

You can install react plugin and then use jsx/tsx in it.

I think I will update that tool to make react work later.

ci010 avatar Apr 10 '21 15:04 ci010