M
M
Magneto9032020-07-13 09:41:50
JavaScript
Magneto903, 2020-07-13 09:41:50

How to properly build an Nw.js application?

I have a simple application. It launches a local server that serves a simple html page on port localhost:8080.
Project structure:
--test_pc_app
----public
------index.html
----package.json
----main.js

package.json looks like this

{
 "name": "test_pc_app",
 "version": "1.0.0",
 "description": "First application",
 "main": "main.js",
 "author": "Developer",
 "window": {
  "show": false
 },
 "dependencies": {
  "express": "^4.0.0",
  "socket.io": "^2.3.0"
 },
 "chromium-args": "--memory-pressure-off"
}


I execute the command:
npm install

As a result, the node_modules folder is created in the root of the project, however, it does not have 2 modules (express and socket.io) as I expect, but 250+ modules, the total weight of which is about 250 mb.

Question: why is this happening and how to avoid it?

Next, I use the nw-builder module to compile this into an exe file (so I think). But at the output I get a folder (weighing 279 mb!), In which, in addition to the exe file, there are a lot of all sorts of dll files.

The structure of the final application:
5f0c01acad8e7446310012.png
Question: how to reduce the size of the folder that I get at the output and how to build the nwjs application so that I have one file (exe) at the output, and not a folder in which, in addition to the exe file, there is a lot more?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question