# 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`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up