jack2
6. März 2018 um 22:23
1
I get this error when installing a plugin in a docker instance:
Compressing: plugin-third-party-ea46d31326df4fb4ed1d79ef5ecad5179b0512d15492b09e348b67b027cced32.js
uglifyjs '/var/www/discourse/public/assets/_plugin-third-party-ea46d31326df4fb4ed1d79ef5ecad5179b0512d15492b09e348b67b027cced32.js' -p relative -c -m -o '/var/www/discourse/public/assets/plugin-third-party-ea46d31326df4fb4ed1d79ef5ecad5179b0512d15492b09e348b67b027cced32.js' --source-map-root '/assets' --source-map '/var/www/discourse/public/assets/plugin-third-party-ea46d31326df4fb4ed1d79ef5ecad5179b0512d15492b09e348b67b027cced32.js.map' --source-map-url '/assets/plugin-third-party-ea46d31326df4fb4ed1d79ef5ecad5179b0512d15492b09e348b67b027cced32.js.map'
Parse error at _plugin-third-party-ea46d31326df4fb4ed1d79ef5ecad5179b0512d15492b09e348b67b027cced32.js:637,7
async function onEvent(container, event) {
^
SyntaxError: Unexpected token: keyword (function)
at JS_Parse_Error.get (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:86:23)
at /usr/lib/node_modules/uglify-js/bin/uglifyjs:384:40
at time_it (/usr/lib/node_modules/uglify-js/bin/uglifyjs:620:15)
at /usr/lib/node_modules/uglify-js/bin/uglifyjs:345:9
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
Removing async/await fixes the issue. It looks like some es6 code is sent to uglifyjs before conversion to es5.
The error doesn’t always occur. A few days ago, I retried installing several times and it finally succeeded. But now I’m stuck again.
Falco
(Falco)
6. März 2018 um 22:27
2
Did you name your plugin file name.js.es6 ?
jack2
6. März 2018 um 22:39
3
Nope, none of my plugin files are named name.js.es6.
cpradio
(cpradio)
6. März 2018 um 22:41
4
Hence the problem, you need to name them with that extension.
jack2
6. März 2018 um 22:44
5
My plugin has just installed correctly, at the 3rd attempt.
cpradio
(cpradio)
7. März 2018 um 00:07
6
If you want it to compile properly, make sure they have a .js.es6 extension, then it will work everytime.
sam
(Sam Saffron)
7. März 2018 um 00:36
7
I am not even sure if we enabled async await in babel @eviltrout ? I certainly have never used it in the Discourse code base.
jack2
7. März 2018 um 13:39
8
@Falco , if your question was about the extension of my files, then yes, I’m using .js.es6 everywhere.
eviltrout
(Robin Ward)
7. März 2018 um 16:07
9
We are not transpiling that. It probably works in the browser if you’re using an evergreen one, but we don’t support it yet.
We could benefit from it, I just haven’t had the time to enable it, make sure the perf is good, and start converting code.
syl
8. Oktober 2018 um 00:16
10
Any news on this? Having it would be great.
sam
(Sam Saffron)
8. Oktober 2018 um 00:43
11
We did start using this in tests, have not decided on our strategy yet for using it in production or not.
syl
23. Februar 2020 um 16:26
12
Haben Sie hier schon Fortschritte gemacht?
sam
(Sam Saffron)
24. Februar 2020 um 01:35
13
@eviltrout hat eine lange Spike-Arbeit begonnen, um uns auf die Nutzung von Ember CLI vorzubereiten. Ein Teil der Arbeit sollte dies als Nebeneffekt klären.
Ich erwarte, dass wir dies innerhalb der nächsten 8 Monate gelöst haben.
Ich habe dieses Problem auch.
opened 06:54PM - 23 Apr 20 UTC
closed 08:11PM - 04 May 20 UTC
Trying to enable this plugin into the current version of Discourse fails with th… e following output.
```ruby
78954.470854151 Compressing: plugins/projects-fe2ea5a8cfbe65a7a4c2549cf8898efc05189a6ac16db43af79144ec69a9432a.js
uglifyjs '/var/www/discourse/public/assets/plugins/_projects-fe2ea5a8cfbe65a7a4c2549cf8898efc05189a6ac16db43af79144ec69a9432a.js' -m -c -o '/var/www/discourse/public/assets/plugins/projects-fe2ea5a8cfbe65a7a4c2549cf8898efc05189a6ac16db43af79144ec69a9432a.js' --source-map "base='/var/www/discourse/public/assets/plugins',root='/assets/plugins',url='/assets/plugins/projects-fe2ea5a8cfbe65a7a4c2549cf8898efc05189a6ac16db43af79144ec69a9432a.js.map'"
Parse error at _projects-fe2ea5a8cfbe65a7a4c2549cf8898efc05189a6ac16db43af79144ec69a9432a.js:104,21
destroy: async function destroy(deleted_by) {
^
ERROR: Unexpected token: keyword «function», expected: punc «,»
at JS_Parse_Error.get (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:18:1), <anonymous>:71:23)
at fatal (/usr/lib/node_modules/uglify-js/bin/uglifyjs:312:27)
at run (/usr/lib/node_modules/uglify-js/bin/uglifyjs:255:9)
at Object.<anonymous> (/usr/lib/node_modules/uglify-js/bin/uglifyjs:173:5)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.
```
Ich verwende name.js.es6 überall.
Bedeutet das, dass ich async/await entfernen muss?
j.jaffeux
(Joffrey Jaffeux)
3. Mai 2020 um 09:43
15
Ja, wir unterstützen async/await noch nicht, wie erklärt.