parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.38k stars 2.27k forks source link

[Web Extension Transformer] doesn't support `background.page` #6494

Closed rraallvv closed 2 years ago

rraallvv commented 3 years ago

🙋 feature request

@parcel/transformer-webextension doesn't pack the background page specified in the source manijest.json file.

🤔 Expected Behavior

The packed extension should have the background.html page with all assets (scripts, css, images, etc.)

😯 Current Behavior

Adding a background page to the manifest.json, like it's shown below, is ignored by the transformer:

{
...
  "background": {
    "page": "background.html",
    "persistent": true
  },
...
}
HaNdTriX commented 2 years ago

just as an escape hatch: try to use background scripts instead:

...
    "background": {
        "persistent": true,
        "scripts": [
            "background.js"
        ]
    }
...
tylervick commented 2 years ago

Definitely a valid workaround (and ideal for most scenarios). I'm attempting to build a Safari App Extension for iOS and listing script sources in the background.html file seems to be the easiest path forward. The only alternative I see is to configure a plugin to merge all imported modules into a single file (a la webpack).

HaNdTriX commented 2 years ago

I thought this is what parcel (bundler) is doing anyway.

Create a background.js and use it as an entry point for all of your scripts. Parcel will bundle this for you, afaik.

tylervick commented 2 years ago

This might be a configuration issue of mine - I think last I tried this I had some files specified in web_accessible_resources which were copied over... I'll try this again without.