Reputation: 11
I am trying to use ECMAScript 6 in my webextension in Chrome 51 (in my background.js code) but I get an error on the first import: "Unexpected token import". I enabled experimental javascript features in Chrome. Is there any information available anywhere about using ECMAScript6 in webextensions?
Upvotes: 0
Views: 440
Reputation: 420
Native support for ES6 modules is quite a thing. A common way to go is to have a build that bundles modules. rollup is commonly used for that.
I just created a skeleton for webExt add-ons that does this.
Upvotes: 0
Reputation: 43052
Firefox supports most parts of ES6, but not modules. It's being worked on under bug 568953.
Upvotes: 1