簡體   English   中英

無法在 deno exe 中動態導入 typescript 文件

[英]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 中像這樣動態導入模塊。

如果有其他方法可以實現這一目標?

從 Deno 版本1.29.1

deno compile當前不支持“動態” import()

這是一個已知問題,正在項目存儲庫中的以下 GitHub 問題中進行跟蹤:

denoland/deno#8655 - deno compile沒有動態導入支持

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM