I have tried that, the problem I am having is the mjs file itself has imports which are not being found.
Let me give some more details. I have this working via a QRC based html file, using the WebEngine to process the javascript. The html, uses the qtwebchannel.js from the qrc, and then also loads 3 javascript files via <script src="..."> tags, all via qrc:/ urls. (some of the tags are in the head and some in the body. This works, however, the overhead of WebEngine is pretty high, so Im trying to find another solution. I have written a js file that does the same functionality, which is what I am trying to use, but I really don’t care what the solution is, as much as I care about getting it working hopefully with less overhead (just the JS engine) The project is https://github.com/towel42-com/T42-MathJaxQt6.git Thanks for any insights you might be able to provide. Scott -----Original Message----- From: Ulf Hermann <[email protected]> Sent: Wednesday, October 29, 2025 03:38 To: Qt Interest <[email protected]> Cc: Scott Bloom <[email protected]> Subject: Re: [Interest] QJSEngine with QRC > For Qt, I have created a QRC file with the node modules, as well as > the script.mjs > > I would like to be able to do something along the lines of > > QJSEngine engine; > > engine.evaluate( “qrc:/js/script.mjs” ) You probably want to do this: engine.importModule(":/js/script.mjs"); It will return a QJSValue of whatever the ECMAScript module in script.mjs evaluated to. best regards, Ulf Hermann _______________________________________________ Interest mailing list [email protected] https://lists.qt-project.org/listinfo/interest
