Forum Bugs

unexpected token reserved("const")

kathar0s
I think this is about ES2015(ES6) problem.

Prince cannot recognize ES6 syntax maybe.

const state = {
activateDownload: false,
toastVisible: false,
toastMessage: '',
toastState: false,
useGNB: true
}

is there a plan to fix this problem?
mikeday
Correct, Prince does not support ES6 at this time. We may fix this in the future, but not in the short term.
jamespaden
Any updated plans to support ES6?

Try DocRaptor - PrinceXML web service and official PrinceXML partner

mikeday
Not yet, but it's something we should think about for 2021. Are there any particular scripts or language features that come up repeatedly?
theadventmaster
Hello Mike,

Alex from DocRaptor support here.

Figure I'll chime in as well since I encounter ES6 concerns in our support queues.

let, Set, Map, and const come up a lot in support inquiries - or at least, they're indicators someone is using ES6+ features and for us to suggest alternatives to them. Functional utilities such as map, reduce, Array.sort, Array.filter, etc. are also commonly used.

Would be great if ES6+ in PrinceXML "just worked". Could make everyone happy both now and in the future (when software vendors inevitably drop ES5 backwards compatibility, which has already occurred with some software libraries).
hallvord
The mentioned array methods are supported - sort, filter, map and reduce :)

Otherwise this looks like a good shortlist, think the only thing I'd add is arrow functions (=>) which I expect to start showing up about now, since IE11 is the only major thing without support at this point.

Announcement: repos for tests/utils