-
Notifications
You must be signed in to change notification settings - Fork 57
Letting users pick their favourite modules loading method #20
Conversation
…directly by module path
This is a breaking change, I think you should file a bug on webpack to make require.resolve work properly |
Hi @paulcbetts , i think @GiovanniFrigo is right , you should really consider adapting this amazing module for webpack. you can use https://github.com/chentsulin/electron-react-boilerplate to check since its the most famous boilerplate for electron and react (i use this too) . And we are all willing to help too , i've just opened an issue at the boilerplate repository , maybe someone dealed with this problem before @GiovanniFrigo i tried your solution but unfortunately this will bring another error with the message FILE_NOT_FOUND , so in my case , it didn't help. thank you |
I actually think that people shouldn't use Webpack with Electron, because it causes problems like this. Instead, you should use electron-forge with the React template (https://github.com/electron-userland/electron-forge-templates) - with less than 1/10th of the code, you'll still get HMR and a complete build and packaging system |
I hear you, this is a breaking change for people already using it. How about I add a method that allows creating a Task Pool from a raw file? This way we wouldn't change anything for existing users, but still allow others (like me or @Revln9) to load modules in other ways. |
@GiovanniFrigo 👍 we should also add documentation for webpack users because i don't think its the only change needed to get this module work with webpack . If you pack your app in an asar file , the module will fail to find the dummy html used to load scripts at the hidden window. now i don't know if its specific to my config but i'm using a pretty well known boilerplate for electron , so i guess i'm not alone. |
@paulcbetts Thoughts on my latest comment? |
@paulcbetts don't mean to nag you, but could you please just tell me if you'd consider a PR allowing for the raw module loading, as described above? That makes an huge difference for me in whether we can use this library or not :/ Again that would be an alternative method of loading modules, not changing the current one. |
+1 for webpack support, it's incredibly popular these days |
Is there a fork of electron-remote that works with webpack? |
Got it working somehow after endless trials , but it's not guaranteed that this will work for you , replace this electron-remote/src/renderer-require.js Lines 57 to 59 in 0559f78
with this
the if statement is an easy fix for the production deployment directory issue (not found). Hope it helps. |
Removing
require.resolve
fromrendererRequireDirect
allows users to load modules in different fashions:ElectronRemote.requireTaskPool(require.resolve('electron-remote/remote-ajax'));
)ElectronRemote.requireTaskPool('../../../dist/electron/workers/uploadWorker');
)See issue #19