Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include a compiler option to omit export statements in Javascript output. #46876

Closed
bdcoder2 opened this issue Nov 19, 2021 · 3 comments
Closed
Labels
Unactionable There isn't something we can do with this issue

Comments

@bdcoder2
Copy link

I am very green with regard to Typescript (as I have only started converting our Javascript codebase), but have been "bitten" by the same problem described in Issue 41513.

I initially posted a similar question on StackOverflow, and found my own (not-very-elegant) solution.

What I (and apparently others) would really like to see is a compiler switch such as:

tsc --noGeneratedExports

Regardless of the compiler option / switch name, the effect would be that tsc would NOT emit statements such as the following (which appear at the top of a Javascript file):

Object.defineProperty(exports, "__esModule", { value: true });

... or the following, which appear at the end of a Javascript file:

export {};

In both cases above, when trying to load the resulting Javascript LOCALLY (from the file system) -- the browser will throw an exception.

Having a compiler option that outputs Javascript that can be loaded into a browser locally would eliminate the need for a module bundler and/or local web server.

Thanks in advance for your consideration.

@MartinJohns
Copy link
Contributor

@bdcoder2
Copy link
Author

Apologies - but if it re-opens the issue, It would REALLY help!

@RyanCavanaugh RyanCavanaugh added the Unactionable There isn't something we can do with this issue label Nov 19, 2021
@RyanCavanaugh
Copy link
Member

Duplicate #39446

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unactionable There isn't something we can do with this issue
Projects
None yet
Development

No branches or pull requests

3 participants