-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpreact.config.js
More file actions
20 lines (18 loc) · 834 Bytes
/
preact.config.js
File metadata and controls
20 lines (18 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { resolve } from 'path';
import CopyWebpackPlugin from 'copy-webpack-plugin';
/**
* Function that mutates original webpack config.
* Supports asynchronous changes when promise is returned.
*
* @param {object} config - original webpack config.
* @param {object} env - options passed to CLI.
* @param {WebpackConfigHelpers} helpers - object with useful helpers when working with config.
**/
export default function(config, env, helpers) {
const htmlPluginSearchResult = helpers.getPluginsByName(config, 'HtmlWebpackPlugin')[0];
if (htmlPluginSearchResult) {
const { plugin: HtmlWebpackPlugin } = htmlPluginSearchResult;
HtmlWebpackPlugin.options.favicon = resolve(__dirname, './assets/favicon.ico');
}
config.plugins.push(new CopyWebpackPlugin([{ context: `${__dirname}/assets`, from: `icon.png` }]));
}