es6 in server side plugin javascript


(David) #1

While developing a plugin, I wanted to include a server_side .js.es6 asset:

register_asset "javascripts/plugin_code.js.es6", :server_side

Client-side, the file compiles to vanilla javascript that the browser can interpret.

Server-side, however, a PrettyText::JavaScriptError - Unexpected reserved word error is being thrown when interpreting:

import someImport from 'path/to/module'

offending line of code:

lib/pretty_text.rb:113:in `block in create_new_context

It makes me think the required feature has not be implemented. Am I wrong?


Awesome BBCodes Plugin: multi-paragraph, nestable, with auto-complete
(Sam Saffron) #2

@eviltrout we may want to add support for this if its a trivial change.


Awesome BBCodes Plugin: multi-paragraph, nestable, with auto-complete
(Robin Ward) #3

It’s not trivial unfortunately, however I’d really like to get it done sooner rather than later.

The text pipeline (dialects) is the only place on Discourse you have to use ES5. It is one of the last holdouts, and once fixed the site will be a lot better for it.