-
-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken react frontend library #358
Comments
I believe I identified the issue. When using hot-reload with react (i.e. react runs a server on port 3000), the URL of globals is specified as:
which is attempting to load from react's dev server (port 3000). It needs to load from neu's dev server. How do we do that? |
Hi @ramezrafla, The underlying issue is that the Neutralino dev tools extension is failing to connect due to a lack of permissions. This was a quirk introduced in the latest release (v5.4.0) and I'm unsure whether or not it was intentional. For now, add these top-level keys to "enableExtensions": true,
"extensions": [{ "id": "js.neutralino.devtools" }] This will allow the dev tools to connect in order to automatically update the URL in your example to point to the neu dev server. |
Dear @benjammin4dayz When I add this extension the token (NL_TOKEN) becomes empty ('') string, and everything breaks The instructions say to add:
which is technically wrong as that file does not really exist, it's called through websocket. This is the root of the issue, we need a way to specify where to get the globals from. |
Admittedly, I'm not sure what could result in an empty string here. If the globals script cannot be fetched, all
When a Neutralino app is started with If you don't mind, please try my fork of codezri/neutralinojs-react as mentioned in the guide you've linked. I've only included the extension's config values. This would be helpful to determine if the issue is specific to your setup. I've included a guide below for the sake of reproducibility. Quick SetupAfter reviewing the code, copy this block of commands into your terminal: git clone https://github.com/benjammin4dayz/neutralinojs-react.git
cd neutralinojs-react
npx @neutralinojs/neu update
cd react-src
npm install
npm run build
cd ..
npx @neutralinojs/neu run Have a coffee while it installs ☕ (create-react-app is so slow) You should see something like this:
If you're seeing Version Info--- System --- --- Global --- --- Project: myapp (js.neutralino.zero) --- Footnotes |
After a bit more digging, I've discovered that the empty string in NL_TOKEN is a result of a failed call to neutralino.config.json "nativeAllowList": [
// ...
"extensions.getStats"
],
"enableExtensions": true,
"extensions": [{"id": "js.neutralino.devtools" }], |
Thanks so much! Indeed, adding Except ... now when we build, the patched src is still in index.html and build fails. If we revert to the form The point is, there is quite a bit of knowledge required to get this working. Granted, we have to deal with a third-party framework so challenges will always remain, we should smooth them out somehow. For now, I can't foresee a clean way of building without a fixed port, with the risk of collision with used ports when deployed. |
Hello, I followed the exact steps in https://neutralino.js.org/docs/getting-started/using-frontend-libraries#react
And get these errors
Even the react setup after fails (another issue will be opened)
The text was updated successfully, but these errors were encountered: