Leverages on favicons to automatically generate your progressive web app for you.
Install the plugin with npm:
$ npm install --save-dev webapp-webpack-plugin
Add the plugin to your webpack config as follows:
const WebappWebpackPlugin =...plugins:'/path/to/logo.png' // svg works too!
The default configuration will automatically generate webapp manifest files along with
44 different icon formats
as appropriate for iOS devices, Android devices, Windows Phone and various desktop browsers out of your single
Tip: You might want to fine tune what vendors to support.
A Note on Path Resolution
Under the hood, Webpack resolves the path to logo according to the following rules:
/path/to/logois absolute, there is nothing to resolve and the path specified is used as is.
./path/to/logois relative, it's resolved with respect to Webpack's
context, which defaults to
path/to/logois neither explicitly relative nor absolute, Webpack attempts to resolve it according to
resolve.modules, which defaults to
In combination with html-webpack-plugin it will also inject the necessary html for you:
html-webpack-pluginmust come before
webapp-webpack-pluginin the plugins array.
HTML injection is skipped for a particular
html-webpack-plugin if either
properties are set to
false in its configuration object, unless
inject is set to
the configuration of
plugins:// Your source logo (required)logo: '/path/to/logo.png'// Enable caching and optionally specify the path to store cached data// Note: disabling caching may increase build times considerablycache: true// Prefix path for generated assetsprefix: 'assets/'// Inject html links/metadata (requires html-webpack-plugin)// false: disables injection// true: enables injection if that is not disabled in html-webpack-plugin// 'force': enables injection even if that is disabled in html-webpack-plugininject: true// Favicons configuration options (see below)favicons:...
To fine tune what icons/metadata is generated, refer to favicons' documentation.
The options specified under
favicons: are handed over as is to favicons,
except that if
developerURL are left
undefined, they will be automatically inferred
author.url as defined in the nearest
package.json if available.
To disable automatically retrieving metadata from
package.json, simply set
null the properties you want to omit.
const WebappWebpackPlugin =...plugins:logo: '/path/to/logo.png' // svg works too!favicons:appName: 'my-app'appDescription: 'My awesome App'developerName: 'Me'developerURL: null // prevent retrieving from the nearest package.jsonbackground: '#ddd'theme_color: '#333'icons:coast: falseyandex: false
To allow other plugins to intercept and customise assets before they are emitted, the following hooks may be tapped
Please keep in mind that every change and new feature should be covered by tests.
This project is licensed under MIT.