React.jsx: type is invalid.

Hey! Recently converted an extension I was developing from custom React to Plasmo + React. I have a contents folder with VideoBadge.tsx(the main component that gets mounted into pages) + a components folder where I store all the components for VideoBadge. The thing is that when I edit something inside the components folder and reload, this always happens. Everything works fine but this error appears
21 Replies
davidgonmar
davidgonmar•2y ago
After some digging its kind of trying to render 2 content elements even though there is only one in the root of contents Is this a bug or how can I fix that?
lab
lab•2y ago
Are you manually mounting your react root? if so, you should use the ts file extension instead. With the tsx extension, Plasmo mount it all for you via the CSUI feature
lab
lab•2y ago
Plasmo Docs
Migrate to Plasmo Framework – Plasmo
A guide on migrating to Plasmo from any browser extension setup.
lab
lab•2y ago
See this docs for more info on migrating to Plasmo
davidgonmar
davidgonmar•2y ago
My contents folder looks like this: -contents -VideoBadge.tsx -components But somehow whenever I change some code on the components folder with the dev server(hmr) enabled, Plasmo will try to mount that component independently, which should not happen since it is not in the root of /components/ if I am not mistaken @louis
Arcane
Arcane•2y ago
@davidgm has reached level 1. GG!
davidgonmar
davidgonmar•2y ago
If I restart the server everything works fine, but its annoying
lab
lab•2y ago
Oh, any files residing in contents are treated as entry files You should move any file that you don't wish to be CS/CSUI outside contents
davidgonmar
davidgonmar•2y ago
Then I think there might be a bug. Plasmo only tries to mount it(and gives an error since they are not really thought to be mounted that way) when I am on the dev server and edit them If that condition is not met plasmo just mounts the component in the root of /contents but files inside folders do not get touched at all What is the expected behaviour? Thanks for the help btw:)
lab
lab•2y ago
are the stuff inside /components also CSUI entries?
davidgonmar
davidgonmar•2y ago
Not really intended to. They are just regular 'export const whatever' React Components @louis
lab
lab•2y ago
yeah you will need to relocate them we dont' have colocation atm, observing nextjs transition to the app dir
davidgonmar
davidgonmar•2y ago
Ok thanks:) but any idea on why it works fine as long as I dont edit their files while in dev server?
lab
lab•2y ago
in dev server, we track them for reloading in prod, they are just statically bundled
davidgonmar
davidgonmar•2y ago
And even on production it works fine
Want results from more Discord servers?
Add your server