-
Notifications
You must be signed in to change notification settings - Fork 74
"__extends" function repeats multiple times inside compiled code. #101
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
Comments
That's just how the TS compiler works. Deduplicating that code is way, way outside the scope of this project. I suppose it's possible that some sort of clever minifier could deal with it, but it would be quite tricky. |
Is it possible to put all TypeScript boilerplate code above compiled modules? Maybe wrap everything in a function so it doesn't become part of the global scope. Is this issue part of tsify functionality or should it be handled by some other 3rd party post-processor? |
The problem is that TypeScript compiles each file as its own separate chunk, including the boilerplate in each one. It would be untenable to try and detect what's boilerplate vs. what's not on a per-file basis. Post-processing might work... I sure wouldn't want to try and maintain it, though. Better would be a TS compiler feature to do some sort of boilerplate extraction. Either way, definitely not going to happen at this level. It's too far removed from what this package does. It's not a bad idea, though. |
Pull-request regarding this issue has already been merged: microsoft/TypeScript#2901 There is |
The following piece of code is being included into each compiled module whenever a class is extended inside that module:
So if you have 10 modules that have a class in each one of them that extends some other class, you'll have 10 exactly the same
__extends
functions in your compiled code.The text was updated successfully, but these errors were encountered: