'Looking for a way to merge multiple js scripts into one for a sandboxed eletron app

I am currently developing an electron app, using typescript.
As the renderer is sandboxed for security reasons, I need to pass a single .js file to the main Window.
However, due to the script being more than 2500 lines, it is currently split in multiple imported files, as would be a normal project.
How could I then merge the js files produced by typescript into a single complete file that could be passed to the electron Window ?
I tried Webpack, but I'm starting to think this is not the tool designed to do it.

what I am looking for:

entry.ts

import { Thing } from "./Thing"
const thing = new Thing();
thing.doSomething("hello world");

Thing.ts

export class Thing {
    doSomething(text: string) {
        // Stuff
    }
}

that would be processed into a single file:
main.js

class Thing {
    doSomething(text) {
        // Stuff
    }
}

const thing = new Thing();
thing.doSomething("hello world");

Thanks for the help !



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source