Open simonschllng opened 7 years ago
Running node-inspector is currently not possible in this project. The reason for this is that the paths in the sourcemaps are incorrect. To validate I cloned the project and committed the dist folder. The result is: https://sourcemaps.io/validate?url=https%3A%2F%2Fgithub.com%2Fsimonschllng%2Fexpress-mongoose-es6-rest-api-ts%2Fraw%2Fsourcemaps%2Fdist%2Fserver%2Fcontrollers%2Fauth.controller.js
Unable to fetch sources in https://github.com/simonschllng/express-mongoose-es6-rest-api-ts/raw/sourcemaps/dist/server/controllers/auth.controller.js.map Error: https://github.com/simonschllng/express-mongoose-es6-rest-api-ts/server/controllers/auth.controller.js (404)
Unable to fetch sources in https://github.com/simonschllng/express-mongoose-es6-rest-api-ts/raw/sourcemaps/dist/server/controllers/auth.controller.js.map
Error: https://github.com/simonschllng/express-mongoose-es6-rest-api-ts/server/controllers/auth.controller.js (404)
In dist/server/controllers/auth.controller.js.map the sourcefile is defined as: {"version":3,"sources":["server/controllers/auth.controller.js"]
{"version":3,"sources":["server/controllers/auth.controller.js"]
Source maps are generated in gulpfile.babel.js#L33:
// Compile ES6 to ES5 and copy to dist gulp.task('babel', () => gulp.src([...paths.js, '!gulpfile.babel.js'], { base: '.' }) .pipe(plugins.newer('dist')) .pipe(plugins.sourcemaps.init()) .pipe(plugins.babel()) .pipe(plugins.sourcemaps.write('.', { includeContent: false, sourceRoot(file) { return path.relative(file.path, __dirname); } })) .pipe(gulp.dest('dist')) );
Following the source maps spec, the sourceRoot() function is optional. It sets the path. However, removing it does not solve the problem.
sourceRoot()
Why is the sourceRoot() function used? How can we fix the source maps?
I want to use node-inspector to debug the code. Is this possible in this project ?
Running node-inspector is currently not possible in this project. The reason for this is that the paths in the sourcemaps are incorrect. To validate I cloned the project and committed the dist folder. The result is: https://sourcemaps.io/validate?url=https%3A%2F%2Fgithub.com%2Fsimonschllng%2Fexpress-mongoose-es6-rest-api-ts%2Fraw%2Fsourcemaps%2Fdist%2Fserver%2Fcontrollers%2Fauth.controller.js
In dist/server/controllers/auth.controller.js.map the sourcefile is defined as:
{"version":3,"sources":["server/controllers/auth.controller.js"]
Source maps are generated in gulpfile.babel.js#L33:
Following the source maps spec, the
sourceRoot()
function is optional. It sets the path. However, removing it does not solve the problem.Why is the
sourceRoot()
function used? How can we fix the source maps?