Skip to content

uibuilder url too long + other issues #2

@TotallyInformation

Description

@TotallyInformation

Hi, the name uibuilder-react-example is too long for newer versions of uibuilder which limit the url to 20 chars max.

Also, there is now a much better way to incorporate this repo into Node-RED.

  1. Add a new uibuilder node to your flow, set the URL and deploy.
  2. Open the Editor config panel and on the Advanced tab, change the "Serve" setting to Dist. The index.html file in the src folder can be deleted.
  3. Open the Editor config panel and change the Template to External. Then use gaillarddamien/uibuilder-react-example as the template. It will import this repo to the correct folder.
  4. Open a command line on the node-red server, navigate to the folder. Run npm install.

There are also a couple of things that don't quite work correctly in your repo depending on how node-red and uibuilder are installed:

  • You should change the dependencies in your repo to devDependencies to avoid future issues.

  • In package.json, "node-red-contrib-uibuilder": "file:../../node_modules/node-red-contrib-uibuilder", will not always work. You should use the live package "node-red-contrib-uibuilder": "*",. Even then npm can really screw things up! So if the build can't find the package, you might have to do some tweaking of your node_modules folder.

  • In src/scenes/UserData.js, the path to the old client is wrong. It should be ../../node_modules/node-red-contrib-uibuilder/front-end/uibuilderfe.

  • Because you are using the "old" front-end client, you need to add the the Socket.IO client to package.json and import it before you import the client.

    ALTERNATIVELY, you can use the new client by changing the import to import uibuilder from '../../node_modules/node-red-contrib-uibuilder/src/front-end-module/uibuilder.module' - however, in that case, although your build works, your dev server fails because I use more modern javascript that Babel cannot understand.

    You could also import the ESM version of the library: import uibuilder from '../../node_modules/node-red-contrib-uibuilder/front-end/uibuilder.esm'. That also works with your build but though it doesn't give an error when starting the dev server, it fails to load Socket.IO correctly.

    So either of the new client builds work fine for node-red itself, they just don't work for the REACT dev server for some reason. It is possible that adding a better JS parser that understands more modern JavaScript might help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions