From 312f34d935b533d61e33b785e8414603a79fcc11 Mon Sep 17 00:00:00 2001 From: viktorstrate Date: Tue, 25 Dec 2018 10:46:59 +0100 Subject: [PATCH] Add support for Firefox's 'moz-extension://' protocol, to bundle-url.js --- packages/core/parcel-bundler/src/builtins/bundle-url.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/parcel-bundler/src/builtins/bundle-url.js b/packages/core/parcel-bundler/src/builtins/bundle-url.js index 533ba60c9f5..b38a6b119d3 100644 --- a/packages/core/parcel-bundler/src/builtins/bundle-url.js +++ b/packages/core/parcel-bundler/src/builtins/bundle-url.js @@ -12,7 +12,7 @@ function getBundleURL() { try { throw new Error; } catch (err) { - var matches = ('' + err.stack).match(/(https?|file|ftp|chrome-extension):\/\/[^)\n]+/g); + var matches = ('' + err.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g); if (matches) { return getBaseURL(matches[0]); } @@ -22,7 +22,7 @@ function getBundleURL() { } function getBaseURL(url) { - return ('' + url).replace(/^((?:https?|file|ftp|chrome-extension):\/\/.+)\/[^/]+$/, '$1') + '/'; + return ('' + url).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)\/[^/]+$/, '$1') + '/'; } exports.getBundleURL = getBundleURLCached;