diff --git a/src/plugins/source-plugin.js b/src/plugins/source-plugin.js
index 287e9908..4b9166be 100644
--- a/src/plugins/source-plugin.js
+++ b/src/plugins/source-plugin.js
@@ -8,6 +8,7 @@ import {
parseSrcset,
normalizeUrl,
requestify,
+ isUrlRequestable,
} from '../utils';
export default (options) =>
@@ -85,6 +86,10 @@ export default (options) =>
return;
}
+ if (!isUrlRequestable(source.value, root)) {
+ return;
+ }
+
const startIndex = valueStartIndex + source.startIndex;
const endIndex = startIndex + source.value.length;
@@ -121,6 +126,10 @@ export default (options) =>
const startIndex = valueStartIndex + source.startIndex;
const endIndex = startIndex + source.value.length;
+ if (!isUrlRequestable(source.value, root)) {
+ return;
+ }
+
sources.push({
name: attribute,
value: source.value,
diff --git a/src/utils.js b/src/utils.js
index f59f0650..572dd0bc 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -1,4 +1,4 @@
-import { stringifyRequest, urlToRequest } from 'loader-utils';
+import { stringifyRequest, isUrlRequest, urlToRequest } from 'loader-utils';
function isASCIIWhitespace(character) {
return (
@@ -378,6 +378,10 @@ export function requestify(url, root) {
return urlToRequest(url, root);
}
+export function isUrlRequestable(url, root) {
+ return isUrlRequest(url, root);
+}
+
function isProductionMode(loaderContext) {
return loaderContext.mode === 'production' || !loaderContext.mode;
}
diff --git a/test/__snapshots__/attributes-option.test.js.snap b/test/__snapshots__/attributes-option.test.js.snap
index 513b2e8d..131fc979 100644
--- a/test/__snapshots__/attributes-option.test.js.snap
+++ b/test/__snapshots__/attributes-option.test.js.snap
@@ -764,7 +764,7 @@ var ___HTML_LOADER_REPLACEMENT_6___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(_
var ___HTML_LOADER_REPLACEMENT_7___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_7___);
var ___HTML_LOADER_REPLACEMENT_8___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_8___);
var ___HTML_LOADER_REPLACEMENT_9___ = ___HTML_LOADER_GET_SOURCE_FROM_IMPORT___(___HTML_LOADER_IMPORT_9___);
-var code = \\"\\\\n\\\\n
My First Heading
\\\\nMy first paragraph.
\\\\nAn Unordered HTML List
\\\\n\\\\n\\\\n - Coffee
\\\\n - Tea
\\\\n - Milk
\\\\n
\\\\n\\\\nAn Ordered HTML List
\\\\n\\\\n\\\\n - Coffee
\\\\n - Tea
\\\\n - Milk
\\\\n
\\\\n\\\\n\\\\n\\\\n\\\\n\\\\nFoo
\\\\n\\\\n\\\\nBAR
\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n
\\\\n\\\\n\\\\n\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n
\\\\n\\\\n\\\\n \\\\n \\\\n
\\\\n\\\\n\\\\n\\\\n\\\\n