Skip to content
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

Open
ramezrafla opened this issue Sep 30, 2024 · 2 comments
Open

Broken react frontend library #358

ramezrafla opened this issue Sep 30, 2024 · 2 comments

Comments

@ramezrafla
Copy link

Hello, I followed the exact steps in https://neutralino.js.org/docs/getting-started/using-frontend-libraries#react

And get these errors

http://localhost:3000/__neutralino_globals.js:1: CONSOLE JS ERROR SyntaxError: Unexpected token '<'
http://localhost:3000/static/js/bundle.js:278:20: CONSOLE JS ERROR Invalid url for WebSocket ws://localhost:undefined?connectToken=undefined
http://localhost:3000/static/js/bundle.js:41067:20: CONSOLE JS ERROR SyntaxError: The string did not match the expected pattern.

Even the react setup after fails (another issue will be opened)

@ramezrafla
Copy link
Author

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:

 <script src="%PUBLIC_URL%/__neutralino_globals.js"></script>

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?

@benjammin4dayz
Copy link

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 neutralino.config.json:

"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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants