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

Conditionalize __esModule emit? #32934

Closed
RyanCavanaugh opened this issue Aug 16, 2019 · 5 comments
Closed

Conditionalize __esModule emit? #32934

RyanCavanaugh opened this issue Aug 16, 2019 · 5 comments
Labels
Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript

Comments

@RyanCavanaugh
Copy link
Member

Numerous issues pointed to from #32083 have people running in environments where it's not safe to emit the __esModule property for whatever reason.

Instead of adding a flag, we could just emit (typeof exports !== 'undefined') && Object.defineProperty(...

Thoughts?

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Aug 16, 2019
@pocesar
Copy link

pocesar commented Oct 23, 2019

one use case for this is, if you use Typescript to generate mongodb atlas stitch code, it won't deploy, unless you manually remove the Object.defineProperty(exports, "__esModule", { value: true }); at the top.
the reason is simple, it expects always one exports = () => {} per file at the top, additional functions on the same file may come at the bottom of the function. so, that conditional check won't help in this case, you should be able to completely suppress that helper function (someone mentioned Closure Compiler, the scenario is alike)

@kirchet
Copy link

kirchet commented Apr 5, 2020

Any updates? Almost one year since this issue was created.

@andrascii
Copy link

Hi, I also ran into the same problem...

@jonathan-nielsen
Copy link

Ignoring issues for over 3 years isn't the way to go. I'm still having this issue and it's almost 2023.

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Declined The issue was declined as something which matches the TypeScript vision and removed Needs Investigation This issue needs a team member to investigate its status. labels Dec 8, 2022
@RyanCavanaugh
Copy link
Member Author

Good call. Given the number of people running into this, I don't think a change to the emit is warranted. Alternate transpilers are available if you need support for a niche runtime; we're trying to scale back the emit configuration matrix to mainline scenarios only.

@RyanCavanaugh RyanCavanaugh closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

6 participants