From bf5ce96e236b8ca0545513a42e251c100ecaa17c Mon Sep 17 00:00:00 2001
From: Ed Morley <501702+edmorley@users.noreply.github.com>
Date: Tue, 23 Jan 2018 14:39:57 +0000
Subject: [PATCH] Bug 1364894 - Make html-loader treat favicons as dependencies
too
Previously `html-loader` only parsed `` tags when
looking for assets/dependencies. Now the `` tags
for favicons are processed too, which means `img/tree_open.png`
and friends will be included in the webpack build and not need to
be manually copied into `dist/img/`:
https://webpack.js.org/loaders/html-loader/
This does not visible change the number of hashed images output to
`dist/`, since the favicons are small enough that `url-loader` inlines
them in the HTML as base64 encoded data URIs (this is adjustable if
not desired later):
https://webpack.js.org/loaders/url-loader/
---
neutrino-custom/base.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/neutrino-custom/base.js b/neutrino-custom/base.js
index aeb97ca90..1821bd6fa 100644
--- a/neutrino-custom/base.js
+++ b/neutrino-custom/base.js
@@ -104,7 +104,11 @@ module.exports = neutrino => {
neutrino.config
.module
.rule('html')
- .loader('html', require.resolve('html-loader'));
+ .loader('html', require.resolve('html-loader'), {
+ // Override html-loader's default of `img:src`,
+ // so it also parses favicon images (``).
+ attrs: ['img:src', 'link:href']
+ });
// Backport Neutrino 8's `test` regex, since Neutrino 4 omitted `.gif`:
// https://github.com/mozilla-neutrino/neutrino-dev/blob/v4.2.0/packages/neutrino-preset-web/src/index.js#L108