S
SolidJS2mo ago
Kasper

What is the idiomatic way to create a universally reusable solidjs component library?

By universally i mean the code should at least be able to be imported both in the browser and in nodejs, not necessarily be able to render everywhere (that would be up to the app to solve, ie for ssr). But I don't want the app to crash just because I happen to import something from the library in ie. node. Some questions I have: - What does a typical package.json look like? - Should the package export two different builds: dom and ssr, or can a single universal build be exported?
- If a single universal build can be exported, how is that done? I'm thinking of the generateoption in vite-plugin-solid that can be assigned universal, but I don't think that does what I'm talking about. That seems to be made for custom renderers. - Or should build tools even be used at all, maybe the idiomatic approach is to deploy untranspiled solid-js code in the package and let the apps do the transpiling? And any other details I might have missed. Are there any good blog posts or docs outlining all the details somewhere?
1 Reply
bigmistqke
bigmistqke2mo ago
GitHub
GitHub - solidjs-community/solid-lib-starter: SolidJS library start...
SolidJS library starter template. Use it to create your own solid package. - solidjs-community/solid-lib-starter

Did you find this page helpful?