简体   繁体   English

无法在 deno exe 中动态导入 typescript 文件

[英]Unable to import typescript file dynamically in deno exe

I am trying to import a file from aws in exe using its public link based on some user input but unable to do so我正在尝试使用基于某些user input的公共链接从aws中的 exe 导入文件,但无法这样做

eg I created my exe using the following command例如,我使用以下命令创建了我的exe

deno compile --allow-all main.ts

User run this exe using command like ./exe --qId 345 .用户使用./exe --qId 345类的命令运行此exe I parse this qId in exe and load some file from public link like this我在exe中解析这个qId并像这样从公共链接加载一些文件

let { runTestCases }  = await import ("https://test-cases.nyc3.digitaloceanspaces.com/<qId>.ts")

But it gives me following error但它给了我以下错误

TypeError: Module not found
at async getQuestionTestCaseFile (file:///F:/CodeQuotient/Deno_exe/deno/Controllers/question_controller.ts:47:37)
at async file:///F:/CodeQuotient/Deno_exe/deno/main.ts:14:1

It works fine when i run it using following command当我使用以下命令运行它时它工作正常

deno run --allow-all main.ts

I want to know whether its possible or not to import module dynamically like this in exe.我想知道是否可以在 exe 中像这样动态导入模块。

If there is some other way of achieving this?如果有其他方法可以实现这一目标?

As of Deno version 1.29.1 :从 Deno 版本1.29.1

"Dynamic" import() is not currently supported in deno compile . deno compile当前不支持“动态” import()

This is a known issue and is being tracked at the following GitHub issue in the project's repository:这是一个已知问题,正在项目存储库中的以下 GitHub 问题中进行跟踪:

denoland/deno#8655 - deno compile does not have dynamic import support denoland/deno#8655 - deno compile没有动态导入支持

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM