Extension to HtmlWebpackPlugin
which embeds icons as data URLs in the output HTML file. Inspired by
InlineChunkHtmlPlugin
from react-dev-utils
package.
npm install --save-dev html-webpack-inline-icon-plugin
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const InlineIconHtmlPlugin = require("html-webpack-inline-icon-plugin");
module.exports = {
// ...
plugins: [
// Generate `index.html` with favicon injected.
new HtmlWebpackPlugin({
inject: true,
template: path.resolve(__dirname, "public/index.html"),
favicon: path.resolve(__dirname, "public/favicon.png"),
}),
// Inline icons with `favicon` in the name.
new InlineIconHtmlPlugin(HtmlWebpackPlugin, [/favicon/]),
// ...
],
// ...
};