[英]How to dynamically initialize a class instance at runtime in Typescript (Nodejs/Deno)
[英]Unable to import typescript file dynamically in deno exe
我正在嘗試使用基於某些user
input
的公共鏈接從aws
中的 exe 導入文件,但無法這樣做
例如,我使用以下命令創建了我的exe
deno compile --allow-all main.ts
用戶使用./exe --qId 345
類的命令運行此exe
。 我在exe
中解析這個qId
並像這樣從公共鏈接加載一些文件
let { runTestCases } = await import ("https://test-cases.nyc3.digitaloceanspaces.com/<qId>.ts")
但它給了我以下錯誤
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
當我使用以下命令運行它時它工作正常
deno run --allow-all main.ts
我想知道是否可以在 exe 中像這樣動態導入模塊。
如果有其他方法可以實現這一目標?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.