neutralinojs-cli
neutralinojs-cli copied to clipboard
NL_* vars not set in client when run with frontend-lib-dev flag
Expected Behavior
All NL_*
global vars should be set in the client regardless of cli flags.
Actual Behavior
None of the NL_*
global vars are set in the client when run with --frontend-lib-dev
flag, despite being present when run with no flag. This results in none of the native API or any server-dependent Neutralino functionality working from the client, as the websocket cannot connect due to undefined NL_PORT
.
This makes development significantly slower and more frustrating as the client has to be re-built and the app re-run to test any functionality dependent on these features.
Steps to Reproduce the Problem
- Run a test app with
neu run
- Confirm that
NL_PORT
(or anyNL_
prefixed global vars) is set either via enabling the inspector or having the client render it - Run the same app with
neu run --frontend-lib-dev
- Observe that
NL_PORT
(and allNL_*
vars) is now undefined (and the websocket connection will have errored, rendering Neutralino broken entirely)
Specifications
- NeutralinoJs Version: 4.4.0
- NeutralinoJs CLI version: 9.2.0
- Platform: macOS Monterey 12.1
I Tried to recreate this problem, but seems like it works fine on Linux. Can you share your code if possible?
I Tried to recreate this problem, but seems like it works fine on Linux. Can you share your code if possible?
App built from this: https://github.com/codezri/neutralinojs-react repo linked to from the official docs here: https://neutralino.js.org/docs/how-to/use-a-frontend-library
Can you try this template and see if this works or not: https://github.com/DEVLOPRR/react-neutralino/
Just tested, and it does not work.
Screenshot of inspector when run with flag:
Screenshot when run without flag (and obviously without live reloading):
@DEVLOPRR It seems unlikely to me that this is an OS-specific issue. When you test that react-neutralino
repo you linked, run with neu run --frontend-lib-dev
, are the NL_* variables declared in the global scope for you? Does the websocket connect to the neutralino backend?
Everything works fine for me, not sure why it's occurring, but passing this issue to Devs who have mac os
I have the same problem when I tried to create an app by doc https://neutralino.js.org/docs/how-to/use-a-frontend-library And on both repos with react examples.
Mac M1, MacOS 12.2.1
Can we please get some macOS dev eyes on this? Development is high friction when the only way to test any change is a complete build and restart of the app.
Hi everyone I am here to add that it is not only MacOS issue... I have same problem... OS info: OS: Linux Distro: Arch/Garuda Linux Kernel Version: 5.19.13 (x86_64) NEU-CLI version:
--- Global ---
neu CLI: v9.3.1
--- Project: **Censored** (js.neutralino.zero) ---
Neutralinojs binaries: v4.7.0
Neutralinojs client: v3.6.0
Tested repos: codezri/neutralinojs-react DEVLOPRR/react-neutralino Self builded by tutorial on Neutralino Docs
Result:
NL_*
variables appear when using neu run
command, but not when neu run --frontend-lib-dev
Have you guys tried to configure the Config Options "patchFile" and "devUrl" ?
Eg:
Have you guys tried to configure the Config Options "patchFile" and "devUrl" ? Eg:
yup, and that's the catch... It is not working somehow
Do you get the log output for the hotfix being applied?
I created a little patch that changes the localhost to 0.0.0.0 after installing the module, it helped me to get the frontendLibrary to work. If you want to give it a try: patch_install.js
You have to install neutralino as a dev dependency like: npm install --save-dev @neutralinojs/neu
or you can change the url by hand if you installed globally, the script will only change the dev dependency though
Please update the neu CLI program. Now we don't use the --frontend-lib-dev
flag and implement a better integration with frontend library development servers :tada: