The following line errors in a UXP based plug-in loaded in InDesign version 19.0 (Mainline Cl #d0cd1dc)
const g_host_o = require('uxp').host;
UDT version 1.9 reports this:
Uncaught TypeError: Cannot read properties of undefined (reading ‘on’)
at new (uxp://uxp-internal/pluginmanager_scripts.js:2)
at Object. (uxp://uxp-internal/pluginmanager_scripts.js:2)
at n (uxp://uxp-internal/pluginmanager_scripts.js:2)
at e.exports. (uxp://uxp-internal/pluginmanager_scripts.js:2)
at uxp://uxp-internal/pluginmanager_scripts.js:2
at Object.get (uxp://uxp-internal/pluginmanager_scripts.js:2)
at VM11 idClientMain.js:31
at e.exports.execScript (uxp://uxp-internal/domjs_scripts.js:2)
at l (uxp://uxp-internal/domjs_scripts.js:2)
at uxp://uxp-internal/domjs_scripts.js:2
Thanks for looking, Zuri.
I did check the entire codebase and there were no .on as a whole word. Closest I got was some:
.onclick
.onchange
.ondblclick
The error stack shows at VM11 idClientMain.js:31 which is the line where, at the time, I had that require('uxp').host; line. Everything above that point in the stack is all uxp-internal/pluginmanager_scripts.js
I can do the require('uxp') just fine. But if I attempt to then use that with something like this: var u = require('uxp'); var h = u.host; then this line would error same as the reported one. Either way works fine with Adobe Photoshop (24 and 25), and Adobe InDesign 18.5 just not Adobe InDesign 19.
From discussions during an online chat, it appears that .host is not provided currently in InDesign v19 prerelease and that it should be by the time the release version of 19.0 reaches ga status.
I’ll just develop using v18.5 until the 19 ga is available.