# egret密技 ### 強制匯入外部 ES6 JS :::success 透過 eval() 執行 global scope async function ```typescript let url = "http://192.168.0.1/test.js"; eval(`(async function () { await import("${url}") })()`); ``` ::: :::warning * await import 只能在 top level 執行 * eval() 是為了規避 egret compiler 的檢查, 不然會出現警告 ``` Critical dependency: the request of a dependency is an expression ``` ::: --- ###### tags: `Egret`