-
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
absolute paths in sourcemap #52
Comments
Does setting the |
Setting sourceRoot to empty string did work, thanks! On Sat, Jan 17, 2015 at 8:48 PM, Ivo Gabe de Wolff <[email protected]
|
Unfortunately, I'm getting the same issue, and setting sourceRoot to '' doesn't appear to resolve it. My build step looks like this:
My TypeScript files are all internal modules present under the 'src' directory, and the generated sourcemap's 'sources' collection ends up containing all absolute paths; while the map file the TypeScript compiler generates when using the --out flag has relative paths. |
Can you set the base property in the options object of gulp-typescript instead of gulp-sourcemaps? |
That solved it, cheers for the help. Edit: Looks like I was mistaken, the first step of the build is now as follows
And I'm still getting absolute filepaths in the sourcemap, any further suggestions would be appreciated. |
I'm also having the same problem. My gulpfile has this: gulp.src("app/**/*.ts")
.pipe(sourcemap.init())
// .pipe(typescript({base:"."})).js
.pipe(concat("app.js"))
.pipe(uglify())
.pipe(sourcemap.write(".", { includeContent: false }))
.pipe(gulp.dest(".")); With the typescript line commented out (they're still plain javascript files, I'm trying to migrate to typescript), the map file contains relative paths. With the line uncommented, the map file contains absolute paths. I tried:
but I haven't found a way to get it to use relative urls with typescript yet. |
I had solved the absolute path problem putting:
in my typescript project object like this:
but a new problem arise... I have source files organized in folders but when I put sourceRoot in project properties all the files paths are removed and the file are flattened out. This is the section of map file without sourceRoot:
but with sourceRoot = '':
I would expect this kind of result:
as I get when i sourcemap javascript instead typescript. |
Solved by removing the sourceRoot option. Because the sourceRoot property was present in the source map, gulp-concat would add that to the source property of the source map generated by gulp-concat, which resulted in an absolute path. That's now fixed by removing sourceRoot from the source-map generated by TypeScript. Also I removed the sourceRoot option, since gulp-sourcemap has a sourceRoot option. Gulpfiles should now look like: return gulp.src('lib/**/**.ts')
.pipe(sourcemaps.init())
.pipe(ts())
.pipe(sourcemaps.write())
.pipe(gulp.dest('release')); If you want to provide a sourceRoot option, you can use .pipe(sourcemaps.write('.', { sourceRoot: 'foo' })) |
In the sourcemap files written together with gulp-sourcemaps the TypeScript files end up with absolute paths instead of relativ paths in the sources tag. This leads to errors when Firefox tries to read sourcemap files and to cumbersome long paths in Chrome.
When using gulp-sourcemaps on javascript files the expected relative paths are set.
The text was updated successfully, but these errors were encountered: