From 129cf37fa52257f70954cef8d16f6d383a101d3b Mon Sep 17 00:00:00 2001 From: "Robert Hurst (Dialpad)" <43556103+rhurstdialpad@users.noreply.github.com> Date: Tue, 18 Dec 2018 12:22:03 -0800 Subject: [PATCH] Add support for `chrome-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 5815b1dd033..533ba60c9f5 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):\/\/[^)\n]+/g); + var matches = ('' + err.stack).match(/(https?|file|ftp|chrome-extension):\/\/[^)\n]+/g); if (matches) { return getBaseURL(matches[0]); } @@ -22,7 +22,7 @@ function getBundleURL() { } function getBaseURL(url) { - return ('' + url).replace(/^((?:https?|file|ftp):\/\/.+)\/[^/]+$/, '$1') + '/'; + return ('' + url).replace(/^((?:https?|file|ftp|chrome-extension):\/\/.+)\/[^/]+$/, '$1') + '/'; } exports.getBundleURL = getBundleURLCached;