app.doScript becomes undefined after plugin reload in UXP Dev Tools

Hi,

I’m developing a UXP plugin for InDesign 2026 (v21.3.3) on macOS 26.3 (Apple M1 Max) and running into a consistent issue with app.doScript after reloading the plugin via UXP Dev Tools.

The problem: On first load, app.doScript works perfectly. After unloading and reloading the plugin in UXP Dev Tools, app.doScript is no longer a function — typeof app.doScript returns undefined. The app object itself is not null or undefined, it is returned from require("indesign") without error. It is specifically doScript (and likely other methods) that are missing from the proxy after reload.

This happens regardless of where require("indesign") is called:

  • At the top level when the script starts

  • Inside the function at click-time

  • require.cache does not exist in UXP, so cache-busting is not possible

Minimal reproduction:

const { app, ScriptLanguage, UndoModes } = require(“indesign”);

document.getElementById(“btn”).addEventListener(“click”, function () {
console.log(typeof app.doScript); // “function” on first load, “undefined” after reload
});

Question: Is there a way to get a valid app.doScript reference after a plugin reload in UXP Dev Tools? Is this a known bug?