-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Add support for --noEmitUnderscoreUnderscoreESModule flag #32083
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
Add support for --noEmitUnderscoreUnderscoreESModule flag #32083
Conversation
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @amcasey, @mjbvz, @minestarks for you. Feel free to loop in other consumers/maintainers if necessary |
good |
any updates on that? |
Which issue is approved to take a PR (i.e. is in the Backlog milestone) ? |
This problem may never be concerned about. |
We need an approved issue for a PR to be looked at, but there doesn't appear to be one. Logged #32934 as the |
I'm using Typescript in an embedded V8 context, and the engine does not assign In my case, my code is not intended to run in any other JavaScript environment, so as a quick and dirty hack to delete these lines in the meantime, I'm using the package.json scripts: "scripts": {
"watch": "sh node_modules/.bin/tsc-watch --onSuccess 'npm run patchTSOutput'",
"patchTSOutput": "find . -path ./node_modules -prune -o -print | grep \\.js$ | xargs -n 1 ex '+g/^Object\\.defineProperty(exports,/d' -cwq"
}, Just thought I'd share for other onlookers in the same situation. If you're running into this problem and you want to target many JavaScript environments, you'd probably be better off inserting undefined guards instead (similar to the suggestion in #32934). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T
The '__esModule' is a standard for CommonJS, but forcing the emit '__esModule' does cause problems for many users.
Issues: #30718 #30166 #22879 #15795 #15685 #14351 #13709 (comment)
For me, I have a script that converts the CommonJS code into a baas cloud code, but the Typescript API has no way to remove '__esModule', I can only do replace string of this code:
But this is not safe, I am not sure if Typescript will change this code in the future: