Sending to module-dev mailing list from OWNERs file in third_party/blink/renderer/core/script (previously tried sending to individual OWNERs). Feel free to redirect if there would be better points of contact.
We are currently in the process of experimenting with migrating Web UI to use Polymer 3 (see
https://crbug.com/965770). One thing that would be helpful for this migration would be to have a way to preload our test script files as modules rather than as classic scripts, so that they can use import 'module_file_name.js' syntax to pull in dependencies. We have experimented a bit with using dynamic imports instead, but these are not supported yet by some pieces of our toolchain. Currently, the test scripts are preloaded using WebUITestHandler::PreloadJavaScript at [1], which ultimately calls to
ScriptController::ExecuteScriptAndReturnValue at [2]. We would like to add a path that would do the equivalent, but evaluate the scripts as modules. An early attempt at doing this can be found here:
https://crrev.com/c/1652708 (specifically see changes in script_controller.cc), but unfortunately it seems like pulling in the imports doesn't work correctly. I am not very familiar with Blink code, so am probably doing several things incorrectly. Do you have any suggestions or guidance regarding whether this is feasible? Also wondering if there are any examples or documentation, that might provide some additional information on how to do this; I am generally following steps I found in various test files that seem to be creating and evaluating modules, but not sure this is the right place to look.