0

I'm thinking about an app that uses electron, react and webpack. But I'm not sure if it make sense to use webpack on electron. I'm definitely sure that using webpack to the react part of an app could benefit a lot but I would like to know if it is the same thing with the electron part of an app.

isemaj
  • 557
  • 1
  • 6
  • 19

2 Answers2

1

Why do you need webpack for some cases even in node.js? Because CJS module resolution can cost a lot depends on your code:

https://twitter.com/samccone/status/1010584941355077632

Friendly reminder that Node startup time due to module runtime parse and compile is non-trivial. Illustrated below is the hello-world webpack common chunks example, As we can see the actual work takes < 1/4th of the time, the rest is lost to the javascript parse ghoul

This applies to Electron because it shares the exact same module resolution.

https://twitter.com/_ojkwon/status/933046538762207232

CJS without bundling CJS without bundling

with webpack bundled with webpack bundled

Still, it means development / deployment pipeline will change entirely, and this is not the guaranteed path of improving cost of module loading. You have to analyze your dependencies, and decide proper path for best performance.

Daniel Beck
  • 20,653
  • 5
  • 38
  • 53
OJ Kwon
  • 4,385
  • 1
  • 20
  • 24
0

Webpack is separate from electron. Webpack is used to bundle js files if you want to bundle your code together. There is a similar question that goes into additional detail here.

Trcoxiv
  • 11
  • 3