Effective Interdependencies Using Electron Distribution Application

I am trying to find an effective way to link and distribute various dependencies (node ​​modules and / or "client" -sitic scripts and frameworks like Angular) with my electronic application.

Although the basic approach npm install module-name --saveworks well for development, after all, it is not so good when it comes to minimizing the size of your application and using mined resources at runtime. For example, almost all npm packages (including node modules) come with a lot of "extra baggage", such as readmes, various versions of components (minified, non-mined, ES2015, no-ES2015, etc.). Although they are great for development, all of these files absolutely do not need to be included in the version that you will distribute.

There are currently 2 ways to sort the address:

  • Electron Builder recommends using a 2 file system package.json.
  • Any dependency that is used during development must be installed on npm with --save-dev, and then prunning should be used when creating the distribution application.

In this regard, I have several questions:

  • I'm not quite sure why there is a need for a 2 file system package.json, if you can install dev-only modules / dependencies with --save-dev, and then use trim during the actual build / compilation of the application?
  • , , npm , / , . , "", , npm, , (, -)?
  • Bower " " (, AngularJS 2, Bootstrap, jQuery ..) npm node (, fs-extra) ?
  • WebPack , " cient", node , - ?
  • , ? Gulp -scripts? Web-pack? ?

.

+4
1

. , .

  • , npm install --save-dev - dev . gulp/grunt/webpack . , . , , npm install --save, . , npm --production , dev-. . , devDependencies peerDependencies npm package.json? .
  • , npm , npm. , . , -, npm .
  • package.json , . , gulp/grunt bundlers, -.
  • gulp/grunt , javascript , webpack/browserify - , . - node js var util = require('./myapp/lib/utils.js') . - gulp . , html js , js , require , . . css , . , . NPM Bower Browserify vs. gulp Grunt vs. Webpack .
  • Webpack , , .
  • -, lib, . , jquery, , /libs/jquery.min.js, "jquery". Webpack jquery lib . , . , npm bower.
    • ES2015 , . . , , . , Babel, gulp. Webpack , - ES2015. ES2015, , , , IE8/9.
    • src, js
    • dist, html .

webpack.dev.config.js webpack.prod.config.js .

, . , . , . , .

+1

Source: https://habr.com/ru/post/1649776/


All Articles