I'm trying to figure out how to add a namespace declaration to my JavaScript bundle.
My typescript class is located in myclass.ts
export class MyClass{
...
}
I am using this class in other files as well
export {MyClass} from "myclass"
...
let a: MyClass = new MyClass();
I compile it using VS Code and use Grunt to automate concatenating different files and minifying them with Terser.
Everything works fine, but I want to add a namespace before my class when using it in JS
<script src="mylib.min.js"></script>
...
var a = new MYLIB.MyClass();
At what point in the process should I introduce the "MYLIB" namespace? I would like to continue working with the export/import pattern without including the namespace or module name inside the TS file.
Is there a Grunt plugin that can help with this? I have been unable to find clear information or samples on this topic.