Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
24
my-app/node_modules/webpack-dev-server/client/utils/getCurrentScriptSource.js
generated
vendored
Executable file
24
my-app/node_modules/webpack-dev-server/client/utils/getCurrentScriptSource.js
generated
vendored
Executable file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
function getCurrentScriptSource() {
|
||||
// `document.currentScript` is the most accurate way to find the current script,
|
||||
// but is not supported in all browsers.
|
||||
if (document.currentScript) {
|
||||
return document.currentScript.getAttribute("src");
|
||||
}
|
||||
|
||||
// Fallback to getting all scripts running in the document.
|
||||
var scriptElements = document.scripts || [];
|
||||
var scriptElementsWithSrc = Array.prototype.filter.call(scriptElements, function (element) {
|
||||
return element.getAttribute("src");
|
||||
});
|
||||
if (scriptElementsWithSrc.length > 0) {
|
||||
var currentScript = scriptElementsWithSrc[scriptElementsWithSrc.length - 1];
|
||||
return currentScript.getAttribute("src");
|
||||
}
|
||||
|
||||
// Fail as there was no script to use.
|
||||
throw new Error("[webpack-dev-server] Failed to get current script source.");
|
||||
}
|
||||
export default getCurrentScriptSource;
|
Loading…
Add table
Add a link
Reference in a new issue