Skip to content
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

Sourcemap chain is broken with plugins prior to babel only for files in folders #2964

Closed
EricABC opened this issue Nov 10, 2015 · 2 comments
Closed
Labels
area: sourcemaps outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@EricABC
Copy link

EricABC commented Nov 10, 2015

When going from TypeScript -> (gulp-typescript) -> ES6 -> (gulp-babel ES2015) -> ES5, sourcemaps are incorrect only for files inside folders. This is using gulp-sourcemaps. I would have thought it has more to do with one of the gulp components, but despite all the parties involved I think I have narrowed it down to occurring inside babel.transform by watching correct values go in (the call made here in gulp-babel). I also dropped in an uglify step at the end just to see if it was related to gulp-sourcemaps, but uglify was able to succesfully get back two stages. I did vary path settings such as gulp.src base and sourcemap write paths, in case I was missing something with configuration, but all cases i tried seemed to reproduce the same issue.

var gulp = require('gulp');
var maps = require('gulp-sourcemaps');
var tsc = require('gulp-typescript');
var babel = require('gulp-babel');

gulp.task('dostuff', function () {
    return gulp.src(['./src/**/*.ts'])
        .pipe(maps.init())
        .pipe(tsc(tsc.createProject('tsconfig.json')))
        .pipe(babel({ presets: ["es2015"] }))
        .pipe(maps.write('.'))
        .pipe(gulp.dest('./src'));
});

Also, a gist for simple reproduction with tsconfig and such: https://gist.github.com/EricABC/5944557c5b54ddba7616
The _ in file names is the path (but basically just put any TS file in a root 'src' folder, and another in 'src/nested').

You will see the 'src/file.js.map' can map to the ts file, but 'src/nested/nestedfile.js.map' goes the the interim ES6 javascript.

Also of interest, Here in gulp-typescript is a line of code with comments that specifically addresses an issue where further plugins not in the root could be affected.

@babel-bot
Copy link
Collaborator

Comment originally made by @johnnyreilly on 2015-11-21T09:22:01.000Z

Possibly related to [[ https://phabricator.babeljs.io/T2864 | Babel6: SourceMap generation problem ]]

@hzoo
Copy link
Member

hzoo commented Mar 16, 2017

Going to close for inactivity/old, maybe similar to #5408, otherwise can open a new issue with repro.

@hzoo hzoo closed this as completed Mar 16, 2017
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 5, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: sourcemaps outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

3 participants