Packaging a library of Streamlit components using Rollup

I’m creating a library of custom Streamlit components that help connect Streamlit users to simulation engines for creating more comfortable and sustainable buildings.

I have a large number of components created already using the Streamlit Component Template.

Right now this repo looks something like this:

streamlit_io
|- component_a
|   |- build
|   |- node_modules
|   |- public
|   |- src
|   |- package.json
|   ...
|- component_b
|- component_c
...
LICENSE
MANIFEST.in
setup.py

As you might imagine, although it’s working this isn’t really scalable because having node_modules in each component takes up a ton of space.

I’d like to take an approach inspired by this template and use Rollup to generate the built components while allowing them to share dependencies.

I’ve made a lot of progress but still haven’t been able to bundle the component Typescript into a .js file that actually works for Streamlit.

Has anyone tried this before? Any success? I’m happy to share more details if there’s anyone who might be interested or able to help. I’ve gone through a ton of examples / tutorials for using React / Typescript with Rollup here are two of the most relevant I’ve collected so far:

Thanks in advance!

1 Like

Relevant thread: