VasilyShelkov/create-react-extension

Multiple content scripts

Opened this issue · 4 comments

Would it be possible to create multiple content scripts?

The use case is needing different permissions on different scripts e.g. one content script is used for post-installation, another for logging a user in, another for the general functionality of the page.

Happy to raise a PR, with some direction

You can try creating a new folder like contentScript folder with the index.js file, then run yarn eject or npm run eject and set up a little in the config to create a new JavaScript file when development and build

Ejecting is certainly an option, but best avoided where possible. Especially in common use-cases like this, where other users would also benefit from it being implemented in core.

Currently, there is no way to add new a new file in the build or devevlopment because all the files and folders are hardcode in config with need to eject to see

Yes, I'm aware it's not possible right now. I'm suggesting it be a feature of CRE and am happy to create a PR if the author would like to see it implemented