New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lastScript detection doesn't seem to be 100% reliable #2465
Comments
@guybedford I observed this periodically. It happens a little more as the number of I think a potential change could be:
A sample proposal for 1 and 2: systemJSPrototype.getCurrentScript = function () {
if (hasDocument && document.readyState === 'loading') {
if (document.currentScript) {
return document.currentScript;
}
var scripts = document.querySelectorAll('script[src]');
return scripts[scripts.length - 1];
}
return undefined;
}; |
I'm open to it - this project once had to support IE, so the constraints may have changed. It's important that whatever is done is tested and correct though! |
Demonstration
when loading two systemjs files:
occasionally,
a.js
's dependencies loading occurs beforeb.js
register, and the lastScript detection would fail to get the correct URL.document.currentScript
would be reliable, but it's not supported on IE, where there's a polyfill here https://github.com/JamesMGreene/document.currentScriptCode Sandbox:
Expected Behavior
100% reliable script URL detection
Actual Behavior
occasionally script URL detection gets the dependencies of a previous bundle being loaded.
The text was updated successfully, but these errors were encountered: