项目作者: sergey-shpak

项目描述 :
Parcel@v2 Transformer WebExtension
高级语言: JavaScript
项目地址: git://github.com/sergey-shpak/parcel-transformer-webextension.git


parcel-transformer-webextension

Parcel plugin to use WebExtension manifest as an entry point (parcel@v2 and json5 supported)

Installation

npm install parcel-transformer-webextension --save-dev

Configuration

Please add following configuration to .parcelrc

  1. {
  2. "transformers": {
  3. "manifest.{json5,json}": ["parcel-transformer-webextension"]
  4. },
  5. "packagers": {
  6. "manifest.json": "@parcel/packager-raw-url"
  7. }
  8. }

Usage

After installing and configuring the plugin, use WebExtension manifest.json as entry point:

  1. parcel src/manifest.json5

Any manifest property (including nested) can be resolved as an asset(html/css/js/png/jpeg),
all you need is to provide proper asset path to manifest property, for example:

  1. // other manifest props
  2. "browser_action": {
  3. "default_icon": "assets/icons/icon48.png",
  4. "default_popup": "action.html",
  5. "default_title": "Action!"
  6. }

Btw, the plugin adds json5 support, so comments and other json5 benefits can be used with WebExtension manifest file. Enjoy!

License

Apache 2.0