Sourcemaps not mapping all the way back to originals
- Dominant language
- JavaScript
- Stars
- 1.3k
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Description
I'm using `gulp-babel` with the `babili` plugin, and the `gulp-requirejs-optimize` module to concat files.
Here's the relevant part of how I'm calling it:
```
return gulp.src(['source/js/main.js'], { base: "source" })
.pipe(sourcemaps.init())
.pipe(optimize(requireJsConfig))
.pipe(babel({ presets: [ 'babili' ], comments: false }))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('build/'));
```
So `main.js` is the entry point for my sources, which uses requirejs to include all the other files. Works great. But the problem is, the resulting sourcemaps only includes the entry point, not any of the other files.
This might look like a problem in gulp-requirejs-optimize, but when I leave out babel entirely, the sourcemaps are perfect. So I must conclude that babel is interfering somewhere that messes them up. I can leave out the babili plugin as well and call babel without any presets - same result.
I've also used [source-map-explorer](https://github.com/danvk/source-map-explorer) to try and visualize the sourcemaps, and it says:
```
> source-map-explorer build/js/main.js
Your source map only contains one source ( js/main.js )
This typically means that your source map doesn't map all the way back to the original sources.
```
Versions used:
* NodeJS 7.6.0
* NPM 4.1.2
* gulp 3.9.1
* gulp-babel 6.1.2
* gulp-sourcemaps 1.11.1
* gulp-requirejs-optimize 1.2.0
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the reported gulp pipeline from source/js/main.js, including gulp-requirejs-optimize, gulp-babel, and gulp-sourcemaps, then inspect the generated map for build/js/main.js. Trace where the concatenated sources are lost when Babel is included; done means the map includes the original required files rather than only js/main.js.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100