electron-webpack icon indicating copy to clipboard operation
electron-webpack copied to clipboard

electron-webpack dev will fail with a globally installed electron

Open robert-cronin opened this issue 5 years ago • 1 comments

  • 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.js the require.resolve("electron") is purely for locating the node_modules. Perhaps we could instead require.resolve("electron-webpack")?

  • In dev-runner.js, electron is spawned with spawn(require("electron")) but this might also be changed to just spawning the electron command with spawn("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

robert-cronin avatar Jul 29 '20 03:07 robert-cronin

#391

robert-cronin avatar Jul 29 '20 03:07 robert-cronin