[BUG] Issue with Content Scripts Not Consistently Loading/Running
What happened?
This happens a lot with DEV mode but have seen it once or twice with PROD.
Basically I will load a page that has the correct filter and nothing loads (including console.logs) If I go in and save the background script TS file manually (no changes) and reload it usually work but sometimes it takes a couple saves.
Version
Latest
What OS are you seeing the problem on?
MacOSX
What browsers are you seeing the problem on?
Microsoft Edge, Chrome
Relevant log output
(OPTIONAL) Contribution
- [ ] I would like to fix this BUG via a PR
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
- [x] I checked the current issues for duplicate problems.
I have this issue as well with 0.9.5. I kind of suspect it might have to do with files being in subfolders?
E.g.contents/Button.tsxworks fine, but contents/login/Button.tsx sometimes fails? Its just a suspicion, I am not sure its actually true.
Yeah I think that is it
On Jul 7, 2025, at 10:09, kl-thamm @.***> wrote:
kl-thamm left a comment (PlasmoHQ/plasmo#1282) https://github.com/PlasmoHQ/plasmo/issues/1282#issuecomment-3045562404 I have this issue as well with 0.9.5. I kind of suspect it might have to do with files being in subfolders?
E.g.contents/Button.tsxworks fine, but contents/login/Button.tsx sometimes fails? Its just a suspicion, I am not sure its actually true.
— Reply to this email directly, view it on GitHub https://github.com/PlasmoHQ/plasmo/issues/1282#issuecomment-3045562404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF2TGSD4WMN4J3Z6LO2S5T3HKERBAVCNFSM6AAAAAB5534Y32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTANBVGU3DENBQGQ. You are receiving this because you authored the thread.
I played around with it a little right now and I am relatively confident thats whats going on.
I looked through the production build files and there is a separate file for Button.tsx if its in the root folder and no file if its in a subfolder and there is also no code included in the main contents.js file.
According to https://docs.plasmo.com/framework/content-scripts using subfolders should be possible though, so that would be a regression.
lol i think I found the issue:
https://github.com/PlasmoHQ/plasmo/blob/9369e2835de237caa60620b74b12ea3e2d4f3600/cli/plasmo/src/features/manifest-factory/base.ts#L479-L482
This loads all files in the root folder but just index files in the subfolders?
@louisgv I saw you fixed another issue related to this. Is this intended? Pretty big gotcha and not document or am I missing something?