JS ES6 modules not being recognized

I am trying to create a sketchup plugin and I have structured my entire codebase in modules and I am getting the following error in the developer console

Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.

Hey you will need to post the offending code if you want help, I don’t think anyone can figure out your problem from the error message alone…

Please learn to use the forum search feature:

Are Javascript Modules possible with UI:HtmlDIalog? - Developers / Ruby API - SketchUp Community

HtmlDialog CEF support for ES modules? - Developers / Ruby API - SketchUp Community

1 Like


It might be possible to spin up a very basic server on localhost for the duration of your HtmlDialog’s loading. Do you have any simplified code you can share? Or, post code for a HtmlDialog using a module that you either post the js code for or a URI link to, and I can see if a server in SU will serve it.

The server would have to be shut down after the modules are loaded. I’m not sure what constraints CEF has for module loading, in particular, whether it would try to ‘ssl verify’ the localhost…

As to spinning up a ‘very basic server’, using a stand-alone ‘localhost’ server (outside of SU) worked fine, as an HtmlDialog loaded an http html page, which loaded a script file. No cors issues, even using http (or, not SSL/TLS).

Due the miserable ‘concurrency model’ that exists in SU, it’s really not practical to run the server in SU. I got it to work, but the only way to do so was with UI.start_timer calls for each ‘accept’ server loop.

I tried threads, and that blocked the HtmlDialog processing.

The timing was critical…