Configuring the paths for sourcemaps can be a pain. This repo has examples that show how source maps can be configured with relative paths and no inlined sources. See gulpfile.js for the examples.
Sourcemaps of files in subdirectories are also working properly. This can be seen by running gulp default, gulp outdir or gulp tsconfig and opening index.html in a browser that supports source maps.
The basic rule is:
- If you don't provide the
outDiroption to TypeScript, thesourceRootoption of gulp-sourcemaps should be the relative path from thegulp.destpath to the source directory (fromgulp.src) - If you set the
outDiroption to the same value as the directory ingulp.dest, you should set thesourceRootto./. - If you set the
outDiroption to a different value, there is no easy rule to configure gulp-sourcemaps. I'd advise to change the value of outDir if possible.