Problem with bundled UI library
Hi Guys! I have a problem with my UI library:
I have super simple component like this:
But unfortunately once im trying to use this component from bundled ui library the "t" props doesn't change
If im trying to do the same things using <P/> as local component (not imported from the "ui" library) everything works as expected
I guess it might be a problem with bundling but I don't know exactly what can cause the problem I've mentioned
Also sharing vite.config from "ui" library im using during build
Does anyone faced same issue? Please, help
8 Replies
I am not sure but it could be, that you are using two different versions of solid
However, it is not common to pass accessors to components, normally one does
{ t: string }
and then calls it like <P t={title()} />
Got it, thanks
Btw using same version of solid library doesn't solve an issue
same for me, if I bundle my ui library, it does not work, if I copy the exact same source code into the project, then the same component works...
@itsyoboieltr I've found out the issue
I've built my ui library using rollup and "rollup-preset-solid" plugin
Here is rollup.config.js
After that library works as expected
It might be a bug with vite-plugin-solid, or vite itself, so for now try to build via rollup
Hope, it helps
When bundled with rollup, my code fails to bundle.. Do you think there is a way to do it with vite?
not sure, I think you are able to fix errors during bundling
What kind of error did you get?
I got vite bundling to work 😄
I needed to add:
this fixed everything for me somehow
@vg
I guess it was bundling the solidjs runtime and that caused some issues
thank you!