Issue metadata
Sign in to add a comment
|
Top-level `await import(...)` not working in console
Reported by
rocca.jo...@gmail.com,
Jan 31 2018
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36 Steps to reproduce the problem: 1. Open devtools console 2. Type `await fetch(location.href)`, confirm it's working fine 3. Now type `await import(location.href)` and you get an error: "Uncaught SyntaxError: await is only valid in async function" What is the expected behavior? Give a correct/descriptive error message (if for some reason this is not possible), or return the imported object. What went wrong? See above. Did this work before? N/A Chrome version: 64.0.3282.119 Channel: stable OS Version: 16.04 Flash Version:
,
Jan 31 2018
,
Jan 31 2018
Thanks for the great edge case! kozy@ could you please take a look?
,
Sep 15
Just a note to say that this is still a problem, and that I also get the "await is only valid..." message when I have a comment in the code that I'm trying to execute: ``` await new Promise(r => setTimeout(r, 1000)); // this comment breaks it ```
,
Sep 25
It has two roots, most important is that we need a way to compile module using protocol. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by rocca.jo...@gmail.com
, Jan 31 2018To clarify, this obviously isn't because we're trying to import `location.href` as a module. Here's a better example to try: `await import("https://cdn.rawgit.com/lodash/lodash/4.17.4-es/lodash.default.js")` And we get the same error message