-
Notifications
You must be signed in to change notification settings - Fork 130
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
Sourcemaps not being correctly mapped for preprocessed files. #460
Comments
I've started debugging through the code looks like the issue is related to the file path being absolute and changing the file to a relative path seems to fix the issue. Problem Code: output.ts@83 // sourceFile.fileNameOriginal = "C:\Users\Matt\Desktop\test\src\all.ts";
// sourceFile.gulp.base = "C:\Users\Matt\Desktop\test\src\";
generator.applySourceMap(consumer, sourceFile.fileNameOriginal, sourceFile.gulp.base); Proposed Solution: generator.applySourceMap(consumer, path.relative(sourceFile.gulp.base, sourceFile.fileNameOriginal), sourceFile.gulp.base); Optional Solution: generator.applySourceMap(consumer); Any thoughts? Will this have any negative repercussion? All tests still pass after making the change. |
Thanks for reporting and investigating. I think that your proposed fix is the desired fix, though I would need to do some testing. The optional solution does not work well, the issue is that all paths (involved with source maps) are relative, but relative to different directories. Can you create a pull request with your proposed solution? Then I'll do some testing with it. |
Just created a pull request for my "Optional/Second Solution". The reason for not going with my "Proposed Solution" is because I wasn't able to test using absolute paths as the expected result would be confined to my dev environment location ("C:\Users\Matt...."). Now thinking about it I could of used something like gulp-rename to work around the issue maybe? :/ I'm still not sure if it would be a problem, could you possibly have a look over it let me know what issue it causes so I can get a better understating. Might even be worth us adding a test round these problem scenarios. |
Thanks for the PR. The test case is a good addition to the test suite. I'm afraid that it might break some other scenario's, but I'll investigate that. I have my mind on other things now but I hope to do that this weekend. I'll try to construct a test case that demonstrates such a scenario. Absolute paths should not be a problem since gulp-sourcemaps' documentation states that the paths in the sourcemap should be relative. |
I can't use gulp-typescript until this issue is solved. I am reverting back to gulp-exec or something like that. |
fixed sourcemap sources being lost for files with existing mappings #460
Fixed in #465 |
@ivogabe any idea of when this will make to a release? |
@giggio I want to go through some issues today and hope to release it today too. |
Given TS files after being preprocessed by gulp-concat or anything equivalent, the sourcesContent on sourcemaps generated result to null and sources listed are not the original src files. Below is my current setup.
Example Setup:
When opening
build/all.js
using source-map-visualization it fails to load.Error: Source 'all.ts' missing.
Expected source map output:
Actual source map output:
The text was updated successfully, but these errors were encountered: