Using external files in theme app extension

davidg123
Shopify Partner
9 1 3

Hey! So I am attempting to create a custom web component in the product page via theme app extension on a custom app that I am planning on allowing Shopify owners to download. I have previous code for the web component that is written in TS (Type Script) and want to reuse it in my theme app extension. So my question is, am I able to include .ts code or any code besides .js and .css into the assets folder or anywhere else in the theme app extension file to allow me to import the web component onto their product page?

 

For reference this is the structure of the file https://shopify.dev/apps/online-store/theme-app-extensions/extensions-framework

I have seen other theme app extension files from other developers and saw that they included more than what was given in the original framework.

 

A separate question but also relevant. The typescript file needs an external library that's downloaded via npm. I know you can install libraries onto a custom app via npm but, would I be able to somehow reference libraries from my app to the theme app extension as a potential solution for my problem above? I have already tried this but have had no luck.

 

Thanks!

Replies 0 (0)