Skip to content
Permalink
Browse files

feat: support `file:` protocol

  • Loading branch information
evilebottnawi committed Jul 25, 2020
1 parent 5303db2 commit 560420567eb0e1a635648b7f4ff0365db475384c
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/utils.js
@@ -2,6 +2,7 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
import { fileURLToPath } from 'url';
import path from 'path';

import { urlToRequest, interpolateName, isUrlRequest } from 'loader-utils';
@@ -82,6 +83,10 @@ function normalizeUrl(url, isStringValue) {
}

function requestify(url, rootContext) {
if (/^file:/i.test(url)) {
return fileURLToPath(url);
}

return mayBeServerRelativeUrl(url)
? urlToRequest(url, rootContext)
: urlToRequest(url);
@@ -521,6 +526,10 @@ function isUrlRequestable(url) {
return true;
}

if (/^file:/i.test(url)) {
return true;
}

return isUrlRequest(url);
}

0 comments on commit 5604205

Please sign in to comment.
You can’t perform that action at this time.