electron-webpack dev will fail with a globally installed electron
- Version: 2.8.2
- Target: 9.0.0
I am using electron as an external package via nixpkgs and as such it is not available in node_modules or via require("electron"). This is causing issues with electron-webpack dev because electron is requireed in dev-runner.js and also require.resolveed in RendererTarget.js. I think there is a solution that would be more appropriate for normal use cases as well as solve the issue I am facing here:
-
In
RendererTarget.jstherequire.resolve("electron")is purely for locating thenode_modules. Perhaps we could insteadrequire.resolve("electron-webpack")? -
In
dev-runner.js, electron is spawned withspawn(require("electron"))but this might also be changed to just spawning the electron command withspawn("electron").
I'm not sure if the last one is acceptable but I will send through a PR anyway. If not, I can fork and release a package under something like electron-webpack-nixos for all the devs who want to use this awesome package with nixpkgs
Might be loosely related to https://github.com/NixOS/nixpkgs/issues/46382
#391