Use a bundler
You can use a bundler, such as webpack or vite, to compile TypeScript code and make a bundle. If you do this, ensure the target is ["web", "es2020"] as shown in the following example of a webpack config file.
Note
If you based your code on any of the TypeScript examples provided, make sure that the TypeScript is compiled to JavaScript.
Tip
The Sitecore Content Hub - External Components video available on the Discover Sitecore channel covers using a bundler.