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
outDir
option to TypeScript, thesourceRoot
option of gulp-sourcemaps should be the relative path from thegulp.dest
path to the source directory (fromgulp.src
) - If you set the
outDir
option to the same value as the directory ingulp.dest
, you should set thesourceRoot
to./
. - If you set the
outDir
option to a different value, there is no easy rule to configure gulp-sourcemaps. I'd advise to change the value of outDir if possible.