Nietzsche's Preposterous Moustache

    webpack-resolve-background-script

    1.0.0 • Public • Published

    webpack-resolve-background-script workflow npm

    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.

    Install

    npm i webpack-resolve-background-script

    DownloadsWeekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    5.35 kB

    Total Files

    6

    Last publish

    Collaborators

    • cezaraugusto