webpack-browser-extension-polyfill v2.0.2
webpack-browser-extension-polyfill
webpack plugin to develop cross-browser extensions and Mozilla Add-Ons.
Develop cross-browser extensions using either chrome.*
or browser.*
namespaces without worrying about setup. Zero-config support to every file declared in your manifest file, including background and content scripts.
Via Mozilla's WebExtension browser API Polyfill, this webpack plugin allows extensions that use the Promise-based WebExtension/BrowserExt API, being standardized by the W3 Browser Extensions group to run on Chromium-based browsers with minimal or no changes. See the polyfill docs for specific info.
Installation
npm install webpack-browser-extension-polyfill --save-dev
Usage
See webpack.config.js example or clone this project + yarn install
+ yarn run demo
.
const BrowserExtensionPolyfill = require('webpack-browser-extension-polyfill')
module.exports {
plugins: [
new BrowserExtensionPolyfill({manifestPath: /* <path-to-manifest-file> */})
]
}
How does it work?
The plugin links declared manifest fields (as long as they are relevant) to the polyfill file created at runtime at the same folder level as the manifest file. The plugin works at thisCompilation time.
API
new BrowserExtensionPolyfill({manifestPath})
manifestPath
Type: string
Path to your browser extension manifest file.
License
MIT (c) Cezar Augusto.