Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

"exports is not defined" error as soon as typescript file is declared as a module #12

Open
fcamblor opened this issue Nov 15, 2022 · 0 comments

Comments

@fcamblor
Copy link

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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant