How to package a web project into an EXE file or install a package

Time:2021-6-5

1. Download address of nw.js: https://nwjs.org.cn/

 

 

2. Create a new configuration file package.json and put it in the root directory

{
“Name”: “ddmsc”, / / the name attribute here is very important, similar to a unique identifier. No less!
“Main”: “power Bi documents – power Bi Microsoft docs. HTM” / / the file to be rendered in the window
“Nodejs”: true, / / true, to enable nodejs
“Description”: “power Bi documents – power Bi Microsoft docs,”,
“Node main”: “app. JS”, / / the entry file of nodejs
“Single instance”: true, / / single instance running, saving memory space
“Chromium args”: “- Disable GPU” / / when Google browser starts, GPU rendering is turned off by default
“Chromium args”: “- Disable cookie encryption” / / disable cookie encryption to disk
“window”:{
“show”:”true”,
“icon”: “img5.png”,
“width”:1566,
“height”:883,
“Position”: “center” / / display in the middle of the screen
“Resizable”: false, / / dragging size is not allowed
“Title”: “power Bi documents – power Bi Microsoft docs” / / invalid, solution: the default value is the title property of the home page
}
}

PS: for other detailed configuration, please go to the official document: https://nwjs.readthedocs.io/en/latest/

3. Example:

For example, I want to package the official documents of power Bi as my own desktop applet

Place the project document in the nw.js source package path

 

 

4. Double click to start.

 

 

 

5. Use enigma virtual box to package the shell (it will increase the startup time), and Baidu search can download and install it

 

6. After the installation, start the program. The default is English. You can select – language and Chinese. Then close the program and restart the program to be the Chinese version

 

 

 

 

 

The packaged file, icon and detailed version information can be downloaded and replaced by other tools

 

 

This will affect the startup time, but it is green to start directly. Deleting this exe disk will not keep any files except the H5 cache information.

Another way is to package the web project as an installation package

The following are the steps to package into an installation package:

Download and install: inno setup compiler

 

Click build to compile.