From 449a48e91894861774b702f072564a3f70a3f595 Mon Sep 17 00:00:00 2001 From: "Robert Hurst (Dialpad)" <43556103+rhurstdialpad@users.noreply.github.com> Date: Fri, 21 Dec 2018 07:00:52 -0800 Subject: [PATCH] Add support for `chrome-extension://` protocol to bundle-url.js (#2434) --- 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;