|
1 | 1 | const path = require("path"); |
2 | | -const { basename } = require("path"); |
3 | 2 | const WebpackBar = require("webpackbar"); |
4 | 3 | const MiniCssExtractPlugin = require("mini-css-extract-plugin"); |
5 | 4 | const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); |
6 | 5 | const TerserPlugin = require("terser-webpack-plugin"); |
7 | 6 | const FileManagerPlugin = require("filemanager-webpack-plugin"); |
8 | 7 | const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin"); |
9 | | -const { extendDefaultPlugins } = require("svgo"); |
10 | | -const { cp } = require("fs"); |
11 | | -const sass = require("sass-embedded"); |
| 8 | +const fs = require("fs"); |
12 | 9 | const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); |
13 | | -const HtmlWebpackPlugin = require("html-webpack-plugin"); |
14 | 10 | const BASE_PATH = path.resolve(__dirname, "."); |
15 | 11 |
|
16 | 12 | module.exports = (env, argv) => { |
@@ -86,29 +82,33 @@ module.exports = (env, argv) => { |
86 | 82 | // template: THEME_PATH + '/index.html', |
87 | 83 | // filename: 'index.html', |
88 | 84 | // }), |
89 | | - new FaviconsWebpackPlugin({ |
90 | | - logo: THEME_PATH + "/icons/logo.png", |
91 | | - mode: "webapp", |
92 | | - cache: false, |
93 | | - outputPath: THEME_PATH + "/icons", |
94 | | - inject: false, |
95 | | - favicons: { |
96 | | - appName: null, // Your application's name. `string` |
97 | | - appShortName: null, // Your application's short_name. `string`. Optional. If not set, appName will be used |
98 | | - appDescription: null, // Your application's description. `string` |
99 | | - developerName: null, // Your (or your developer's) name. `string` |
100 | | - developerURL: null, // Your (or your developer's) URL. `string` |
101 | | - loadManifestWithCredentials: false, |
102 | | - icons: { |
103 | | - android: true, // Create Android homescreen icon. `boolean` or `{ offset, background }` or an array of sources |
104 | | - appleIcon: true, // Create Apple touch icons. `boolean` or `{ offset, background }` or an array of sources |
105 | | - appleStartup: false, // Create Apple startup images. `boolean` or `{ offset, background }` or an array of sources |
106 | | - favicons: true, // Create regular favicons. `boolean` or `{ offset, background }` or an array of sources |
107 | | - windows: false, // Create Windows 8 tile icons. `boolean` or `{ offset, background }` or an array of sources |
108 | | - yandex: false, // Create Yandex browser icon. `boolean` or `{ offset, background }` or an array of sources |
109 | | - }, |
110 | | - }, |
111 | | - }), |
| 85 | + ...(fs.existsSync(THEME_PATH + "/icons/logo.png") |
| 86 | + ? [ |
| 87 | + new FaviconsWebpackPlugin({ |
| 88 | + logo: THEME_PATH + "/icons/logo.png", |
| 89 | + mode: "webapp", |
| 90 | + cache: false, |
| 91 | + outputPath: THEME_PATH + "/icons", |
| 92 | + inject: false, |
| 93 | + favicons: { |
| 94 | + appName: null, |
| 95 | + appShortName: null, |
| 96 | + appDescription: null, |
| 97 | + developerName: null, |
| 98 | + developerURL: null, |
| 99 | + loadManifestWithCredentials: false, |
| 100 | + icons: { |
| 101 | + android: true, |
| 102 | + appleIcon: true, |
| 103 | + appleStartup: false, |
| 104 | + favicons: true, |
| 105 | + windows: false, |
| 106 | + yandex: false, |
| 107 | + }, |
| 108 | + }, |
| 109 | + }), |
| 110 | + ] |
| 111 | + : []), |
112 | 112 | ].filter(Boolean), |
113 | 113 | module: { |
114 | 114 | rules: [ |
|
0 commit comments