Rollup plugin for browser extensions.
Add the plugin to your Rollup config
import extension from 'rollup-plugin-browser-extension'
export default {
// ...
plugins: [
extension()
]
}
The plugin makes a 'browser'
module available, which exports APIs from chrome
and browser
. It also exports browser
for any APIs not added yet.
import { browser, runtime, tabs } from 'browser'
runtime.onMessage.addListener(() => {
// ...
})