08784671e7adcc418af239a544a192a4301ee92ef67d94e36d7981f9989dd755.json 994 B

1
  1. {"ast":null,"code":"/**\n * @returns {string}\n */\nfunction getCurrentScriptSource() {\n // `document.currentScript` is the most accurate way to find the current script,\n // but is not supported in all browsers.\n if (document.currentScript) {\n return document.currentScript.getAttribute(\"src\");\n }\n\n // Fallback to getting all scripts running in the document.\n var scriptElements = document.scripts || [];\n var scriptElementsWithSrc = Array.prototype.filter.call(scriptElements, function (element) {\n return element.getAttribute(\"src\");\n });\n if (scriptElementsWithSrc.length > 0) {\n var currentScript = scriptElementsWithSrc[scriptElementsWithSrc.length - 1];\n return currentScript.getAttribute(\"src\");\n }\n\n // Fail as there was no script to use.\n throw new Error(\"[webpack-dev-server] Failed to get current script source.\");\n}\nexport default getCurrentScriptSource;","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}