map input source map#1626
map input source map#1626johnnyreilly merged 22 commits intoTypeStrong:mainfrom Ka0o0:map-input-source-map
Conversation
Can you explain why this is the case please? Also this PR doesn't do
Significantly, use of |
We only need to call the source-map lib if we have an input source map, otherwise we can do an early return, see this here: https://github.com/TypeStrong/ts-loader/pull/1626/files#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80R685
Yes you are right, the webpack loader interface doesn't support the await/async syntax. In this PR the only method that got changed to an async from a sync method is the |
|
If you could convert the code to make it do async in the webpack style I'll take a look. I'm on the fence with this feature tbh but I will consider it. It involves taking another dependency which I'm generally hesitant about |
|
Great thanks! I've now removed the usage of async/await. Just one note about the dependency. |
|
Also don't you need to .destroy as well? https://www.npmjs.com/package/source-map#new-sourcemapconsumerrawsourcemap |
|
Good point, I've added that. BTW I won't have time to further work on this PR the next two weeks, please feel free to make any changes. |
|
One day we'll get to have the tests fully run |
|
Okay, tests pass. I need to update the test pack for TypeScript 5.2. I'm trying to decide if we should add a comparison test for this also. The |
okay, so I guess you want to merge the other PR first? Sorry the lock file slipped through then, I'll update it. Regarding the test, I would love to add a test but I think for this I would need to have more guidance from you. As I wrote in the original issue, my problem with the current ts-loader is that I'm not able to debug Vue projects since the input source map generated by the vue-loader was discarded. For the test, is it okay to add the vue-loader as another dev dependency? |
|
Yeah I want to get the test pack PR merged first. Getting meaningless CI failures so I'm using this as an excuse to thin the test matrix a bit. It's way too big. Could you update the yarn.lock file please? |
|
I've rebased my changes onto main and updated the |
|
I wouldn't worry - probably just different yarn versions |
|
Could you have a go at writing a new comparison test please? You can learn about comparison tests here: https://github.com/TypeStrong/ts-loader/blob/main/test/comparison-tests/README.md I would think you can copy / paste the existing sourceMaps test as a starting point. Don't worry if it turns out to be problematic. I think I put this test in the "nice to have" camp rather than the "we need this" camp. |
|
I've added a comparison test which requires the |
|
if it's a What you've done looks like a good start - but I wonder if we could do the symLink that currently sits in the |
|
Okay I think I actually don't have to link anything really - the thing with |
|
Sorry this keeps slipping my mind. Do you want to update the version number in the package.json and add an entry to the CHANGELOG.md please? https://github.com/TypeStrong/ts-loader/blob/main/CHANGELOG.md v9.5.0 seems appropriate |
|
No worries, done. Hope the description is okay like this. |
|
Released! Thanks for your work! https://github.com/TypeStrong/ts-loader/releases/tag/v9.5.0 |
Reopening of #1367
Resolves #1457
Since there was a question about the performance in the original PR: this won't cause any performance regressions for the cases where ts-loader is the first loader, so basically for any plain
.tsfile. For the other cases I would say that functionality goes over performance, since it's currently a serious problem to not have input source maps handled.