-
Notifications
You must be signed in to change notification settings - Fork 12k
Javascript files are mapped to TypeScript compiled code instead of the original code #15804
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
Hi, I tried this and I cannot reproduce. I am not sure from where that Here what I got by following your reproduction steps Sourcemap contents function add(a, b) {
return a + b;
}
export { add };
//# sourceMappingURL=test.js.map Actual transpiled JS contents /*! exports provided: add */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "add", function() { return add; });
function add(a, b) {
return a + b;
}
//# sourceMappingURL=test.js.map |
Hi, by transpiled code I mean the code compiled by Typescript and not the final code generated in main.js. If the Sourcemap content above was the original code, why there is the added code below in the last line. |
Hi, did you need more info, or the issue is clear now? |
To better show the difference between the original file and the TypeScript compiled file, I added async to the add function in the testjs.js file above, as follows: async function add(a,b){
return a+b;
}
export {
add
} The sourcemap contents becomes import * as tslib_1 from "tslib";
function add(a, b) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return a + b;
});
}
export { add };
//# sourceMappingURL=testjs.js.map Here we can see that the sourcemap is mapped to the TypeScript compiled file and not the original file. If we change the file name extension to testjs.ts, instead of testjs.js, we get exactlly the content of the original file. |
Hi @alan-agius4. Can you please tell me if there is any progress on the issue ? I’m integration the PDF.js viewer (written in JavaScript) in an Angular project. When debugging with Chrome DevTools I can see the TypeScript compiled code and not the original files and there is a big difference between the two versions compared to the simple examples above. The problem is when debugging with Visual Studio 2017. In this case, it is impossible to step over the code since Visual studio shows the original code but steps over the Typescript compiled code (i.e. breakpoints cannot be set or sometimes can be set over comments). Thanks. |
Hi @Hakimon, unfortunately we did have time yet to investigate the issue. |
@aminanan I also get this issue, but in Create-React-App with TypeScript. I have tried (note: my case may or may not be relevant to this issue, but I hope it helps to know that this problem is real) One noticeable thing is the file is |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Description
Javascript files are mapped to transpiled code instead of the original code.
🔬 Minimal Reproduction
Create new app
Add '"allowJs": true' in compilerOptions section of tsconfig.json
Create file testjs.js in src/app
Change app.component.ts to
🔥 Exception or Error
The mapped file 'webpack:///./src/app/testjs.js' under Chrome shows the following code
🌍 Your Environment
Anything else relevant?
The text was updated successfully, but these errors were encountered: