-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
require('electron') in isDev fails with webpack #24
Comments
@glass-edge there's nothing wrong by changing something that was not well configured for this use case. You should change your webpack config as mentioned on this issue on electron-react-boilerplate repo Just edit your /**
* Determine the array of extensions that should be used to resolve modules.
*/
resolve: {
fallback: {
path: false,
fs: false,
},
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
modules: [webpackPaths.srcPath, 'node_modules'],
// There is no need to add aliases here, the paths in tsconfig get mirrored
plugins: [new TsconfigPathsPlugins()],
}, This should fix the issue you are facing! |
Heyo @daltonmenezes ! |
From what I've tested, I assume it's not the same issue. Could you please describe better the problem you're facing? |
Thanks @daltonmenezes. I ended up requiring more modifications to the code to accommodate my situation unfortunately. In packaged application I must still use My initial problem is addressed though, no objections to closing this issue anytime. |
I'm building an electron app based on electron-react-boilerplate with these versions:
electron: ^31.3.0
react-router-dom: ^6.22.3
electron-router-dom: ^2.0.0
webpack: ^5.88.2
And react-router-dom didn't work out of the box, so I tried electron-router-dom which seems to be functional, however with one problem. There is a function isDev that calls require('electron') and fails with the following error:
I am not familiar with webpack, and it looks like changing its configs would be too intrusive a change. Ideally the issue would be fixed by changing isDev function in electron-router-dom not to call require. Perhaps isDev variable could be injected with an argument to createElectronRouter?
Is there any quick fix to this? Right now I'm thinking of patching
\node_modules\electron-router-dom\dist\esm\index.js
to amend isDev behaviour.The text was updated successfully, but these errors were encountered: