Merge pull request #101 from caohuilin/fix-worker-url

Fix getWorkerUrl Regex
This commit is contained in:
Alexandru Dima 2020-02-21 00:00:46 +01:00 committed by GitHub
commit 9548c68804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -197,7 +197,7 @@ function createLoaderRules(languages: IFeatureDefinition[], features: IFeatureDe
getWorkerUrl: function (moduleId, label) {
var pathPrefix = ${pathPrefix};
var result = (pathPrefix ? stripTrailingSlash(pathPrefix) + '/' : '') + paths[label];
if (/^(http:)|(https:)|(file:)/.test(result)) {
if (/^((http:)|(https:)|(file:)|(\/\/))/.test(result)) {
var currentUrl = String(window.location);
var currentOrigin = currentUrl.substr(0, currentUrl.length - window.location.hash.length - window.location.search.length - window.location.pathname.length);
if (result.substring(0, currentOrigin.length) !== currentOrigin) {