| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | Basic build | 
					
						
							|  |  |  | ----------- | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | Default desktop electron app build (modifying the electron dist in-place): | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	make | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | Build desktop electron app with full repack:  | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	(export BUILD_MODE=repack && make) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | Build package files for web: | 
					
						
							| 
									
										
										
										
											2018-01-12 20:43:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	make web | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | Sharp and other native modules for nw/electron | 
					
						
							|  |  |  | ---------------------------------------------- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | To build sharp for a specific version of node and nwjs: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	cd ./node_modules/sharp/ | 
					
						
							|  |  |  | 	nw-gyp rebuild --target=0.17.4 --arch=x64 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | And for electron (done by make): | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	electron-rebuild | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Chromium flicker issue (nw) | 
					
						
							|  |  |  | --------------------------- | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-04 05:18:12 +03:00
										 |  |  | The UI sometimes flickers -- at first blanks out to black then re-draws, | 
					
						
							|  |  |  | this is most noticeable on white or gray backgrounds.  | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | This appears to be GPU related. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | package.json: | 
					
						
							|  |  |  | 	"chromium-args": "--disable-gpu-compositing", | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-04 05:18:12 +03:00
										 |  |  | This will fix the issue temporarily, but we still need a better solution. | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | Remote debugging via DevTools (nw) | 
					
						
							|  |  |  | ---------------------------------- | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | Set this in package.json: | 
					
						
							|  |  |  |   "chromium-args": "--remote-debugging-port=9222", | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Then open http://localhost:9222 in chrome. | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-13 01:59:52 +03:00
										 |  |  | Speedup loading of app (nw) | 
					
						
							|  |  |  | --------------------------- | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | One of the ways to speed up the load times when packed is to store Node's | 
					
						
							| 
									
										
										
										
											2016-10-04 05:18:12 +03:00
										 |  |  | modules ./node_modules in a separate location, outside of the app.zip | 
					
						
							| 
									
										
										
										
											2016-05-08 16:13:19 +03:00
										 |  |  | or package.nw | 
					
						
							|  |  |  | To enable require(..) to find them: | 
					
						
							|  |  |  | 	- > npm install --save app-module-path | 
					
						
							|  |  |  | 	- when building the zip move all the modules out to a new location | 
					
						
							|  |  |  | 	  *except* app-module-path | 
					
						
							|  |  |  | 	- add this line to all root js modules *before* any other  | 
					
						
							|  |  |  | 	  require(..) is called: | 
					
						
							|  |  |  | 	  	if(process.__nwjs){ | 
					
						
							|  |  |  | 			var path = require('path') | 
					
						
							|  |  |  | 			require('app-module-path') | 
					
						
							|  |  |  | 				.addPath(path.dirname(process.execPath)  | 
					
						
							|  |  |  | 					+ '/node_modules/') | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 |