neutralinojs / neutralinojs.github.io

The official website and documentation of Neutralinojs
https://neutralino.js.org
MIT License
248 stars 133 forks source link

Add the note about port option for `neu run` when enabling HMR #357

Open alexamy opened 4 weeks ago

alexamy commented 4 weeks ago

Documentation page

https://neutralino.js.org/docs/getting-started/using-frontend-libraries#enabling-hot-reload-and-configuration

Problem

When using the patchFile option to provide an HTML file for patching in neu configuration, each time you run the neu run command, the port number in the script tag changes to a different one. If the HTML page is version-controlled in Git, there's a risk of accidentally committing this change. The problematic line is:

<script src="http://localhost:44913/__neutralino_globals.js"></script>

Solution

Add the note about using of the --port command line option when running neu run. Setting a constant port number prevents changes to the port in index.html file. For example:

neu run -- --port=44913
ramezrafla commented 6 hours ago

Or add port to the config file