PlasmoHQ / plasmo

🧩 The Browser Extension Framework
https://www.plasmo.com
MIT License
10.03k stars 346 forks source link

[RFC] Content script PlasmoCSConfig should have optional ability to be excluded from compiled content script source #888

Open sleekslush opened 6 months ago

sleekslush commented 6 months ago

How do you envision this feature/change to look/work like?

We could add an option to the PlasmoCSConfig type called includeInline or something similar. When this exists and is true, don't include it in the manifest dict, but also when building the content script, strip the config declaration out completely.

What is the purpose of this change/feature? Why?

In some cases, I need to include/exclude a large number of matching domains for content scripts. This behavior is only relevant for inclusion in the manifest.json file, but the code is still included as part of the injected content script and completely unnecessary.

(OPTIONAL) Example implementations

export const config: PlasmoCSConfig = {
    "matches": [ /* ... some very long list ... */ ],
    "includedInline": false // causes final build to exclude this config declaration from the content script code
}

(OPTIONAL) Contribution

Verify canary release

Code of Conduct