-
Notifications
You must be signed in to change notification settings - Fork 507
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
When built with "importHelpers": true, tslib is not used #962
Comments
That's close to what TSDX does under-the-hood but
So I didn't write that, but yes I would like to remove if it if possible. I had looked into it before and remember finding some edge cases, but can't remember all of them (I've probably detailed them in some issue or PR). Off the top of my head, it wasn't clear if other deps rely on this or if it's used when transpiling to ESNext too.
The eventual plan I'd like to move to is to have authors include
It would be quite breaking, but the automatic detection in the above linked comment would simplify that a lot. But that's a whole feature that needs to be built before this is really possible. |
I took a quick look again and found #72 and #73 that seem to have erroneously added In any case, would have to do a lot of testing to make sure it can be safely removed. It's existed for so long that things may even unintentionally work as a result of that mistake. |
Yup, this is what I meant by "remove" as it's unused and I checked that in the code. Sorry that I didn't mentioned that, as I thought maintainers are well aware of all that. My opinion what is the most optimal solution now IMO would be to ignore TSC emit JS completely, and use babel for everything TS->JS, esbuild as uglifier, and tsc only for declarations. You can also compile with esbuild and apply optimizations only with babel, but that i never tested myself to recommend. |
Well what I meant is that, it's not clear if it's never used in any builds, or if it just so happens that the builds we've observed never use it. I assume the latter is the majority case as well, and it's just edge cases where it might be used. Or maybe it is just none at all -- but don't want to break existing things without knowing for sure. The old issues I linked to are from previous maintainers, so based on that and other linked issues, I'm fairly certain they were not aware of that. The rest is pretty off-topic, but I'll respond a bit.
Babel doesn't support various TS features or certain parts of the ecosystem, so that's not so straightforward. And it would be kind of disingenuous to claim being "TS-first" while not supporting those.
I was gonna say there's a whole issue on ESBuild already in #716 and that someone recently added an excellent write-up on some of the progress in the past year ...and then I saw that you were that person! 😅 But yea, as I wrote there, we wouldn't be able to support any Babel plugins that way. If we ran Babel afterword or at all that would defeat the purpose of optimizing with ESBuild. Even using Rollup eliminates a lot of the benefit because the difference is in orders of magnitude (as opposed to additive or even multiplicative). I'll respond more in that issue at some point (I was literally just re-reading it before you replied).
Is that new? In your comment on the ESBuild issue you said Jest still wasn't supported. If you could add that there that would be great, would very much prefer to have all the info in one place |
Current Behavior
I build with
importHelpers: true
resulting bundles are still inlining helpers and aren't importing them fromtslib
.Expected behavior
tslib
helpers are imported where it's needed.Suggested solution(s)
If it's not a bug and
babel
used to transpile the code and nottsc
, then removetslib
as well as theimportHelpers: true
from templates and add@babel/runtime
as a dependency. If it's a controversial/breaking change, add it as an optional setting.Your environment
The text was updated successfully, but these errors were encountered: