mdn / js-examples

Code examples that accompany the MDN JavaScript/ECMAScript documentation
https://developer.mozilla.org/en-US/docs/Web/JavaScript
Creative Commons Zero v1.0 Universal
1.12k stars 699 forks source link

"Uncaught SyntaxError: Unexpected reserved word" is reported at getColors.js:5 #11

Closed bin787 closed 3 years ago

bin787 commented 3 years ago

with Chrome Version 88.0.4324.182 (Official Build) (32-bit), https://mdn.github.io/js-examples/modules/top-level-await/ fails to load as expected with the error as title reported. Same with Fire Fox 85.0.2 (64-bit).

Looks like "export default await colors;" has some issue with the usage of await here.

can you please have a look?

chrisdavidmills commented 3 years ago

@Rumyra this example now seems to be giving the same error as it did a little while ago. Can you have a quick look? Many thanks.

bin787 commented 3 years ago

I just cross-checked browser compatibility and found that neither 88.0.4324.182 (Official Build) (32-bit) nor FireFox 85.0.2 (64-bit) support the top level await yet. I think this issue can be closed. thanks for your attention.

chrisdavidmills commented 3 years ago

I think it may well need attention. I'm using Firefox Nightly and have top-level await enabled, and it is still erroring for me.

chrisdavidmills commented 3 years ago

The error I get is "Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data".

I think we got this once before and it was something simple like a path issue...

Rumyra commented 3 years ago

Yes it's a path issue again - running the repo locally and viewing the live sample on gh have different paths... I'm just having a think, but leave it with me - it's fixable 👍 thanks @chrisdavidmills

Rumyra commented 3 years ago

OK fix works in Chrome & FF (with pref) for me so I'm going to keep this issue closed - lmk if there's any problems 👍

bin787 commented 3 years ago

@chrisdavidmills and @Rumyra thanks for prompt actions though the actual issue is different from the one originally reported.