зеркало из https://github.com/mozilla/treeherder.git
Bug 1364894 - Make html-loader treat favicons as dependencies too
Previously `html-loader` only parsed `<img src="...">` tags when looking for assets/dependencies. Now the `<link href="...">` 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/
This commit is contained in:
Родитель
49339088f6
Коммит
bf5ce96e23
|
@ -104,7 +104,11 @@ module.exports = neutrino => {
|
||||||
neutrino.config
|
neutrino.config
|
||||||
.module
|
.module
|
||||||
.rule('html')
|
.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 (`<link href="...">`).
|
||||||
|
attrs: ['img:src', 'link:href']
|
||||||
|
});
|
||||||
|
|
||||||
// Backport Neutrino 8's `test` regex, since Neutrino 4 omitted `.gif`:
|
// 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
|
// https://github.com/mozilla-neutrino/neutrino-dev/blob/v4.2.0/packages/neutrino-preset-web/src/index.js#L108
|
||||||
|
|
Загрузка…
Ссылка в новой задаче