sueddeutsche / editron

Editron - an JSON-Editor, which takes a JSON-Schema to generate an HTML form for user input and live validation
31 stars 4 forks source link

Installation in a node.js (electron) application is a little different #3

Open snipercup opened 4 years ago

snipercup commented 4 years ago

The examples work perfectly in a browser, but when loaded into a node.js application, it starts complaining about m not being defined. I found out that it's not loading mithril properly.

To fix it, I used NPM to install the mithril package and added "var m = require("mithril");" to editron-modules.js, which I have stored locally. Now I can load up your example, point to the local json files and it works.

sagold commented 4 years ago

Hi snipercup.

Thank you very much for the input. Per default, mithril is expected as an external dependency. This ensures, that only one mithril resource is loaded, if the application also uses mithril (mainly in browser contexts). It might be an option to prepare a separate nodejs-bundle in this case. I have not thought of electron in this context.

How did you embed editron within your application?

In most of may cases i directly compile editron and ensure that editron is compiled (or added) to my builds within the app-layer.

snipercup commented 4 years ago

I put a Githubissues.

  • Githubissues is a development platform for aggregating issues.