ESR52 SpiderMonkey & ES6
Kent Williams <[email protected]> Wed, 20 Jun 2018 15:11:10 -0500
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
Been beating my head on this for a couple of days. I'm trying to get ES6 module support working with ESR52 SpiderMonkey. I can run plain scripts just fine, but if I try using ES6 modules, it breaks. I solved one problem: You can't compile anything 'import' in it without setting the Module resolver with JS::SetModuleResolveHook. Then it turns out you can't use JS::Compile with any code with 'import' in it -- even if it isn't a module itself. But if you use JS::CompileModule, it isn't clear what you have to do to execute the script. What should happen is that you do X (where X is unknown) to execute the script, and then the interpreter handles the 'import' statements in your code by calling the resolve hook. So my problem is X -- if you have to use JS::CompileModule if there are any import statements in a script, how do you execute the script? Looking at the JS Shell code, the resolve hook is actually in a Javascript file. I tried doing what that file does (ModuleLoader.js) but it doesn't work. I call ModuleDeclarationInstantiation followed by ModuleEvaluation -- and both fail without any error message. They return false, and there's no apparent error message anywhere. Is it the case that no one uses ES6 modules with SpiderMonkey, except perhaps the Mozilla Browswer & the js shell included? _______________________________________________ dev-tech-js-engine mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine