1.0.0 • Published 3 years ago
webpack-resolve-background-script v1.0.0
webpack-resolve-background-script
Resolve background scripts defined in a WebExtension manifest file
Allows a WebExtension to link to background scripts defined the manifest file even after compilation. If your webpack config needs to copy the extension manifest to the output folder, this plugin ensures background scripts point to the right path.
How it works
Before compilation
Directory
./yourWebExtension/
├── public
│ └── manifest.json
└── src
└── background.js
Manifest
{
"manifest_version": 2,
"name": "Your browser extension",
"version": "1.0",
"background": {
"scripts": [ "../src/background.js" ]
}
}
After compilation
Directory
./yourWebExtension
├── background.js
└── manifest.json
Manifest
{
"manifest_version": 2,
"name": "Your browser extension",
"version": "1.0",
"background": {
"scripts": [ "./background.js" ]
}
}
Usage
See webpack.config.js example.
const WebpackResolveBackgroundScript = require('webpack-resolve-background-script')
module.exports {
plugins: [
new WebpackResolveBackgroundScript(/* <path-to-dist-manifest-file> */)
]
}
API
new WebpackResolveBackgroundScript(manifestDistFilePath)
manifestDistFilePath
Type: string
Path to your webExtension manifest file after compilation.
License
MIT (c) Cezar Augusto.
1.0.0
3 years ago