Creating Package - Need Bundling Help

This is the first time I have tried to create a library, and I need help 😅 Objective: Provide a convenience library to make it easy for people to integrate several other libraries in a SolidJS client app (browser only; no SSR for now). Problem: I tried to build with tsup using https://github.com/solidjs-community/solid-lib-starter as a starting point, but some of the libraries have a dynamic require that errors in the browser.
My Lib --> Imported Lib that uses require to get --> Third Party Lib It not clear to me if I need to solve for this when building the library or on the client side. Any direction or recommendations would be much appreciated.
Thank you in advance 🙏
GitHub
GitHub - solidjs-community/solid-lib-starter: SolidJS library start...
SolidJS library starter template. Use it to create your own solid package. - GitHub - solidjs-community/solid-lib-starter: SolidJS library starter template. Use it to create your own solid package.
11 Replies
thetarnav
thetarnav15mo ago
Could you prepare a small repro of how the package is being built, and used? It would be easier to iterate on the problem and find a solution, as I haven’t seen that issue before. Also, solid-primitives is using tsup, with the preset used in the linked template, what happens if you try to use one those packages in your app?
SilentRhetoric
SilentRhetoricOP15mo ago
Hey, thanks for reaching out. I am using a primitive or two and have never encountered any issues with them. But the libs I am trying to integrate in my lib are not as simple and elegant as the Primitives! I will tidy up the repo and demo site for my lib and share it so you can see, probably later this week. It is not particularly complex, so I think it will be easy to see what’s happening.
SilentRhetoric
SilentRhetoricOP15mo ago
OK, I have made the repo public now https://github.com/SilentRhetoric/solid-algo-wallets The package code is in src The demo app that produces the error is in dev Use the build+pack script to build with tsup and pack the lib into a tarball with npm pack The demo app imports the lib from a file path in package.json Let me know if this enables you to see the issue 🙏
GitHub
GitHub - SilentRhetoric/solid-algo-wallets: Integrate multiple Algo...
Integrate multiple Algorand wallets with a SolidJS web application client - GitHub - SilentRhetoric/solid-algo-wallets: Integrate multiple Algorand wallets with a SolidJS web application client
SilentRhetoric
SilentRhetoricOP15mo ago
@thetarnav Also, please feel free to let me know if this is beyond what is reasonable to ask for help with.
I just know that bundler stuff has given me more gray hairs than anything else, and I’ve never published a browser package before, so I’m just trying to read stuff online and try random config setting & plugins. But I’m spiraling and lost 😅
thetarnav
thetarnav15mo ago
I don't mind looking at it just didn't have a moment to do it today the tsup preset is designed for the "solid-primitives-like" usecase so I'm not surprised that something is wrong if you try to do someting completely different. I use stuff like rollup, esbuild, tsc and tsup depending on the usecase, there is no silver bullet afaik
SilentRhetoric
SilentRhetoricOP15mo ago
No worries, didn't mean to chase! On background, I did try using rollup but was not successful with that, either
thetarnav
thetarnav15mo ago
on first glance the pkg looks fine what use breaks it?
SilentRhetoric
SilentRhetoricOP15mo ago
Are you able to load the example site? In the dev folder
thetarnav
thetarnav15mo ago
ah it's in dev ok nvm
thetarnav
thetarnav15mo ago
GitHub
Pnpm workspace, fix prod deps, patch walletconnect module export by...
It's still not working And patching deps probably won't work when distributing a package But at least the error is different added pnpm workspace so that /dev and the package are sharing ...
SilentRhetoric
SilentRhetoricOP15mo ago
Wow! Thank you! I will get back into this as soon as I’m done with my day job. Thank you!
Want results from more Discord servers?
Add your server