PlasmoHQ / plasmo

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

Why isn't there a packaging configuration file #958

Open iomjympq99190 opened 5 months ago

iomjympq99190 commented 5 months ago

What is the example you wish to see?

When I have over 10 content files, only the ones that have been packaged are very large. Why isn't there a packaging configuration file that extracts public libraries into global variables and reuses them

Is there any context that might help us understand?

No response

Code of Conduct

aiktb commented 4 months ago

The global context of each content script is independent and it is not possible to access functions across contexts.

This is determined by the extension architecture and has nothing to do with plasmo, which the Chrome Extension Document calls isolated worlds.

So if you have 10 content scripts, and all 10 content scripts reference the same library, plasmo must bundle that library in every generated content script.

Half-A-Turnip commented 4 months ago

@aiktb But you can create a shared bundle and then reference this shared bundle in the content_scripts of each script in order. "js": ["js/chunk-vendors.js", "js/content.js"],