Re: What's up with "import declarations may only appear at top level of a module"

Kent Williams <[email protected]> Mon, 6 Aug 2018 08:39:42 -0500
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
There's a simple issue: Scripts with anything related to modules require 
using JS::CompileModule. Regular JS scripts require using JS::CompileScript

I got onto the #JSAPI IRC channel and with the help of those people I 
was able to build something that works.

You're using a newer version of SpiderMonkey than I targeted, so you may 
have to do some tweaks.  If you get it working please submit a pull 
request to me that shows your changes.

https://github.com/Chaircrusher/SpiderMonkeyES6Example

You've (yet again) become a victim of Mozilla's spotty commitment to 
documentation.  I would respectfully submit that having "Ask the actual 
developers on IRC" as a documentation strategy is frustrating and flawed.

On 06/13/2018 03:58 AM, Miles wrote:
> Sorry, I don't know the answer to this, but I would be very interested to find out if you manage to get it to work. I'm trying to upgrade our Spidermonkey embedding from 1.8.5 and I have grabbed version 59. I'm very interested to know if/how ES6 features are enabled. Are they by default or do you have to call some functions etc.
> If you find the solution please can you post. Many thanks.
> _______________________________________________
> dev-tech-js-engine mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine

_______________________________________________
dev-tech-js-engine mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine