ts-browser
ts-browser copied to clipboard
"exports is not defined" error as soon as typescript file is declared as a module
As soon as one of the typescript files are considered a module (as soon as you either use import
or export
keywords) we get an error stating :
exports is not defined
Case to reproduce :
- Create a ts file with following content :
// module-test.ts
export const hello = "world";
- Import it in your html file :
// index.html
<html>
<head>
<script type="text/javascript" src="https://unpkg.com/ts-browser"></script>
<script type="text/typescript" src="./module-test.ts"></script>
</head>
<body>
Demo
</body>
</html>