【发布时间】:2020-12-03 17:53:14
【问题描述】:
尝试在 Deno REPL 中导入模块会导致以下错误:
Uncaught SyntaxError: Cannot use import statement outside a module
at evaluate (rt/40_repl.js:60:36)
at replLoop (rt/40_repl.js:160:15)
我几乎每天都使用 Node REPL 快速测试代码。无需编写脚本或处理临时文件即可导入外部代码的能力非常方便。
为什么 Deno 不能在模块外使用 import 语句?甚至可以在 Deno REPL 中使用外部代码吗?
【问题讨论】:
标签: deno