#Creating Package - Need Bundling Help

13 messages · Page 1 of 1 (latest)

tulip kettle
#

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

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.

severe kiln
#

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?

tulip kettle
#

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.

tulip kettle
# severe kiln Could you prepare a small repro of how the package is being built, and used? It ...

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

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

tulip kettle
#

@severe kiln 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 😅

severe kiln
#

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

tulip kettle
#

On background, I did try using rollup but was not successful with that, either

severe kiln
#

on first glance the pkg looks fine
what use breaks it?

tulip kettle
#

Are you able to load the example site?

#

In the dev folder

severe kiln
#

ah it's in dev ok nvm

severe kiln