Forum Documentation Showcase Pricing Learn more

Does the plugin editor accepts ES6 JavaScript?

#1

I was trying to use template literals and create variables with “let” but it never accepted. Is there an option to enable ES6?

EDIT: Yes it does. Leaving the original question btw.

#2

I think this question should be rephrased as:

Is modern JavaScript code (ES6+) in a plugin transpiled to ES5?

That’s a very important question as I’d love to use spread operator, rest operator, etc…

#3

Up!) Interesting question, want use arrow functions in plugins and template.

#4

I think the only way to know it is testing… load up a context where only ES5 would work then run the code. Something like an old version of a browser.

Also, I use template literals and arrow functions all the time and all goes well.

#5

Thank you!) Need test it!)

#6

By looking at the JS files used by some Bubble apps, I can see they are minified. Usually JS minification is done together with transpiling…

Anyway, I think only the team can give us details on which features are transpiled and polyfilled.

#7

Now I just confirmed Bubble doesn’t transpile code from plugins. I had some arrow functions and consts in a plugin and couldn’t get it to work in IE10. After replacing those features by their ES5 equivalents, the plugin worked.

1 Like
#8

Ew, IE10! Just kidding, who knows what use cases may arise out there… thank you for testing and reporting it back to us!

#9

I know how you feel :joy:.

Safari has some gotchas too. Actually, better be cautious with any new EcmaScript features as even Chrome may have issues depending on its version. Unfortunately there are always those users (mostly in desktop) that don’t update their browsers.

But Bubble should transpile the code (and perhaps integrate with something like CodeSandbox for better tooling).