plasmo icon indicating copy to clipboard operation
plasmo copied to clipboard

[BUG] presence of the src folder causes unexpected behaviour

Open monarchwadia opened this issue 8 months ago • 1 comments

Thank you for the amazing work on this MUCH-needed framework.. Plasmo is amazing and makes my job a lot easier :-)

Actual behaviour

When an empty /src is present, Plasmo ignores all of the root-level entrypoints such as /sidepanel.tsx, /popup.tsx, /options.tsx, causing the manifest to be empty of any entrypoints. It shows a non-descriptive WARN in the console when this is the case.

image

Expected behaviour / suggested fix

When /src is present, but some root-level entrypoints also exist (such as /sidepanel.tsx, /popup.tsx, /options.tsx), Plasmo should throw up a more descriptive warning that aids in quick debugging... something like the following maybe...:

When the "/src" folder exists, all entrypoints should exist within "/src". However, we found the following entrypoints in your "/" folder: ["/sidepanel.tsx", "/popup.tsx", "/options.tsx"]. These will be ignored and will not be added to the manifest file. In order to fix this issue, please ensure that all your entrypoints are in the "/src" folder, or delete the "/src" folder altogether.

Impact of bug

When encountered, this issue is a showstopper for any POC or exploratory work that is trying out Plasmo as a possible framework. Most likely, fixing this bug will result in an uptick in adoption.

I spent a few hours spinning my wheels today on this. I'm pretty sure it discouraged me from using Plasmo the first time I encountered it, and that was for a commercial project (we went back to their homegrown solution).... I wonder how many developers silently quit on Plasmo because of this one.

Additional anecdotal description of impact

After seeing the existing non-descriptive WARN message, my extension stopped working completely --- no popup would show up. When I checked the manifest file, it did not show the popup declaration at all. Same for sidebar, options, etc... everything just disappeared. This was very confusing because everything was fine before. I rm -rf'd all my node_modules, the .plasmo/ directory, the build/ directory, and did pnpm store prune. I even did a git checkout HEAD^ and the issue still persisted. Eventually, I cloned my repo locally and things seemed to work fine... until they stopped working all of a sudden yet again.

This causes a lot of confusion, because oftentimes a developer will have created /src/components and is still expecting to be working on root-level /popup.tsx but with the presence of the src folder all of these are ignored. To make matters worse, git doesn't always delete empty folders, and so even doing a git checkout HEAD^ will not solve the issue for the developer.

Thank you

Thank you again for the amazing plugin, I hope this bug report helps make it even better :-)

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

Chrome, Firefox

Relevant log output

No response

(OPTIONAL) Contribution

  • [x] 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.

monarchwadia avatar Dec 03 '23 01:12 monarchwadia