-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
es module imports in repl don't work #1285
Comments
Typescript isn't supported in the repl yet, #1158. |
That isn't a TypeScript feature persay... The |
Now that #1460 (ES module support) has landed, can someone provide a quick line that can be entered in the REPL to verify that the import statement is working? I'm still seeing this, even with the new support from #1460 that just landed:
Executing:
The latest version in git shows the prior version number, but the |
I believe this kind of imports will never be available in REPL since ES imports/exports are static. However, you can use the |
If this is impossible... Perhaps import could be translated to import () prior to evaluation e.g. with regex. Or, perhaps less drastically, but less usefully, the repl could suggest import() syntax be used upon seeing this error (and regex match). |
@hayd To do such translation, top level await (or at least some way to pause the REPL during
at this moment |
Can you not import inside an eval? I don't think i follow RE pausing. you'd do the translation to import() in the ts side. I'll see what i can come up with ... |
Import won't work until the REPL uses module evaluation instead of traditional script evaluation... It's unclear to me how this would work... I suggest punting on fixing the REPL until the native ES modules stabilizes a bit more. |
The Chrome dev tools (and I think d8, though I haven't tried it) support dynamic import ( It appears to still be an issue with Node.js though. |
I think that |
Fixed in #7784; dynamic imports is the way to go when importing in REPL |
When in the Deno REPL and executing:
import { env } from "deno";
The output is:
SyntaxError: Unexpected token {
Probably related to #1158
Executing:
deno -v
on the commandline returns:deno: 0.2.1
v8: 7.1.302.4
typescript: 3.2.1
The text was updated successfully, but these errors were encountered: