Skip to content

Commit 197b7b1

Browse files
committed
fix(favicon): use favicon-webpack-plugin only when favicon file exists
1 parent 5b45e7e commit 197b7b1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/webpack.config.common.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const history = require("connect-history-api-fallback");
44
const highlight = require("rehype-highlight");
55
const emoji = require("remark-emoji");
66
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
7+
const fs = require("fs");
78
const commonPaths = require("./paths");
89

910
module.exports = {
@@ -79,6 +80,8 @@ module.exports = {
7980
},
8081
plugins: [
8182
new webpack.ProgressPlugin(),
82-
new FaviconsWebpackPlugin(commonPaths.faviconPath),
83-
],
83+
fs.existsSync(commonPaths.faviconPath)
84+
? new FaviconsWebpackPlugin(commonPaths.faviconPath)
85+
: null,
86+
].filter(e => e),
8487
};

0 commit comments

Comments
 (0)