diff --git a/lib/wrapper-end.js b/lib/wrapper-end.js index 3d1fcc4c..12b771d9 100644 --- a/lib/wrapper-end.js +++ b/lib/wrapper-end.js @@ -7,6 +7,8 @@ var doPolyfill = typeof Promise === 'undefined'; if (typeof document !== 'undefined') { var scripts = document.getElementsByTagName('script'); $__curScript = scripts[scripts.length - 1]; + if ($__curScript.defer || $__curScript.async) + $__curScript = document.currentScript; if (doPolyfill) { var curPath = $__curScript.src; var basePath = curPath.substr(0, curPath.lastIndexOf('/') + 1);