-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
TypeScript 4.7 source map file extension mismatch #49335
Comments
This seems to be another unintended consequence of the fact that TypeScript does not rewrite extensions to source files for you. #49083 is asking for a change in this behavior. |
@unional the branch you mention above (https://github.com/unional/tersify/tree/webpack) does not seem to be available as I get a 404 when trying to visit the link, so I'm not 100% clear on the context. This is a longstanding TypeScript behavior. We do not rewrite the extensions you use in your Are you certain this is related to TS 4.7? From what I can tell you also recently changed your module references from an extensionless form to include the |
Hi, I have restored the branch. Yes this TS 4.7 related and yes, it is related to the In TS 4.7, in order to support This is likely caused by the source map is referencing the actual file path ( |
Source maps are supposed to reference the source file path: https://sourcemaps.info/spec.html#h.mofvlxcwqzej. The I'm not clear on what you are saying is broken here. It's possible that |
Please follow the steps and description above:
The bottom line is, the source-map generated by TypeScript works in one way, does not in another. When consuming a package, written in TypeScript or not, the source map should work. The fact that it was written in TypeScript should be out of the picture. |
I've just revisited this issue and I do not see anything that TypeScript is doing wrong here. The source maps we emit are correct, and looking the bundled outputs in both the Chrome dev tools and Edge dev tools correctly show the original If there was a bug here, I expect it was either in I am closing this issue as I cannot reproduce it and there does not appear to be any further action that can be taken. |
Bug Report
π Search Terms
source map, extension
π Version & Regression Information
TypeScript 4.7.2
β― Playground Link
Not a Playground link, but the repro is here: https://github.com/unional/tersify/tree/webpack
To repro it, run
yarn bundle
and open thedemo.html
in browser.You can see that the
source-map-loader
able to get theunpartial/ts/index.ts
file, but not the files it referenced (./required.js
,./unpartial.js
).This is because the files are actually in TS. i.e.
required.ts
andunpartial.ts
.I'm not sure if this is a TypeScript 4.7 bug or
source-map-loader
needs to be updated to support this.But given it was working prior to TypeScript 4.7 and JS in general,
it is likely that the sourcemap generated by TypeScript 4.7 needs some adjustments.
π» Code
The referenced code
unpartial
is here: https://github.com/unional/unpartialIt is build with
sourceMap: true
intsconfig.json
Since this is related to how the code is build and consumed, I don't have a minimal repro for this.
But the library I chose to demo this are simple enough that should be simple enough.
π Actual behavior
Unable to consume the source map generated by TypeScript library using TS 4.7
π Expected behavior
Should work, as shown in this branch: https://github.com/unional/tersify/tree/webpack-old
The text was updated successfully, but these errors were encountered: