I would like to create a project using Typescript modules, however allow it to be consumed from vanilla javascript.
Lets say it contains 3 modules each containing a single class, A
, B
, and C
.
i.e.
A.ts:
export default class A {
/* things */
}
B.ts:
export default class B {
/* things */
}
C.ts:
export default class C {
/* things */
}
All of these are built and bundled into one dist.js
file with webpack. I would like the user of the library to be able to do something akin to
<script src="dist.js"></script>
<script>
var foo = new LettersLibrary.A();
</script>
how would I go about doing this, ultimately the goal is to be able to develop taking advantage of typescript modules, but provide a library usable from vanilla js.