How to get a single JS file as output from Svelte code?

I want to create a JS file that executes some code on another independent page, when injected dynamically through a script tag. The code that needs to run, I’ve written it in Svelte. So How Can I get the code as a single HTML file? Currently, there’s separate CSS, HTML, JS files when building the bundle.

I can also write the code in react if need be, if it’s not possible with Svelte for some reason.

The code is to create a button, that creates an iframe on the page. Then the content within the iframe takes it from there.

How do I achieve this goal of creating a single JS file with the css and html included?

Source: Ask Javascript Questions