plasmo icon indicating copy to clipboard operation
plasmo copied to clipboard

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

Open sleekslush opened this issue 6 months ago • 0 comments

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

  • [ ] I would like to contribute to this RFC via a PR

Verify canary release

  • [X] I verified that the issue exists in plasmo canary release

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] I checked the current issues for duplicate problems.

sleekslush avatar Feb 08 '24 14:02 sleekslush