I recently have the idea to use the threejs library to extends the possibilities of my extension in its UI:HtmlDialog.
Does anyone know if it’s possible to use JS modules in SketchUp extensions ?
I’ve also found that is not possible to use modules, probably because HtmlDialog loads files with the file:// protocol (though it would be nice to have a Sketchup developer confirm this).
I am getting around this by using Vite in library mode, but you could do something similar with Rollup, Webpack, etc. But I would like to find a way around this. The vast majority of modern libraries are distributed in modules.
That depend entirely on how you use it. The most normal way HtmlDialogs are used are by loading local resources bundled with the Extension using .set_file. But you can load from an http(s) source using set_url. But you cannot load local files using set_url. You’d in that case need to spin up a local webserver and serve to localhost, which quickly adds overhead to what you need to bundle with your extension. (Not to mention that you’d have to find an unused port, and potentially battle with local firewalls)