1.0.23 • Published 5 years ago

crx3-webpack-plugin v1.0.23

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

crx3-webpack-plugin

A Webpack plugin to bundle chrome extensions for CRX3. The api is essentially identical to crx-webpack-plugin, and you can simply swap the two and go.

Inspired or enabled by the following projects:

crx-webpack-plugin

crx3

API

add the plugin

yarn add -D crx3-webpack-plugin

require it:

const crx3 = require('crx3-webpack-plugin');

configure the plugin:

// webpack.config.js

module.exports = {
  entry: //...,
  output: //...,
  plugins: [
    new crx3({
      updateUrl: 'url-to-update.xml',
      updateFilename: 'update.xml',
      keyFile: './build.pem',
      contentPath: './build',
      outputPath: './dist',
      name: 'my-extension.crx',
      zip: true,
      browserVersion: '64.0.3242'
   })
  ]
}

Configuration Settings:

OptionRequiredTypeDefaultAbout
contentPathyesstringnonelocation of build files. should be the webpack output folder to consume your bundle(s).
outputPathyesstringnonewhere to export the built extension.
keyFilenostringgenerates build.pema private key required to update the extension.
namenostring'crx'the name of the built extension
updateUrlnostringnonewhere to find updates.xml
updateFilenamenostringnamefilename for updates.xml
zipnobooleanfalseprovides a zip of the build files along with the CRX.
browserVersionnostringnonespecify a minimum browser version for the app.

Note: your build process should copy your manifest.json to outputPath before the plugin runs, or it will fail.

Important Note: CRX_REQUIRED_PROOF_MISSING

See crx3 for further details. Essentially, due to tightening regulations regarding the sources of chrome extensions, most users will be unable to install extensions built with this plugin, and it will be difficult to update them. This plugin therefore is probably not suitable for public Chrome Extensions. Your best bet is probably to bundle your application via Webpack and build and distribute manually through the web store. This plugin is useful for managing enterprise plugins however, provided that you're able to enforce a managed policy.