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

gulp-sourcemap-write: source file not found: ? #34

Closed
robianmcd opened this issue Sep 11, 2014 · 3 comments
Closed

gulp-sourcemap-write: source file not found: ? #34

robianmcd opened this issue Sep 11, 2014 · 3 comments

Comments

@robianmcd
Copy link

When I try and uglify my code without concatenating it and then generate source maps I get an error message like:

gulp-sourcemap-write: source file not found:C:\Rob\Dropbox\Repos\gulpTest\?

my gulp task looks like this

gulp.task('js', function () {
    return gulp.src('app.js')
        .pipe(sourcemaps.init())
        .pipe(uglify())
        .pipe(sourcemaps.write())
        .pipe(gulp.dest('build'));
});

I'm using the following versions of npm modules

  "dependencies": {
    "gulp": "3.8.8",
    "gulp-uglify": "1.0.1",
    "gulp-sourcemaps": "1.1.5"
  }

There is a zipped up version of the project here https://dl.dropboxusercontent.com/u/20066539/Forum%20Links/Other/gulpTest.zip

Any idea why this isn't working?

Thanks

@floridoo
Copy link
Member

Seems to be a bug in gulp-uglify. It does not pass on the sources array correctly. Please report the bug there.

@terinjokes
Copy link

@floridoo we made your suggested changes to resolve exactly that… but you never replied on the ticket. We've been using vinyl-sourcemaps-apply since 1.0.0.

@floridoo
Copy link
Member

@terinjokes vinyl-sourcemaps-apply does not fix incomplete source maps. In the example above the source map that is passed to vinyl-sourcemaps-apply looks like this:

{"version":3,"file":"app.js","sources":["?"],"names":["test","console","log"],"mappings":"AAAA,GAAIA,MAAO,CACXA,QACAA,OACAA,OACAA,OACAA,OAEAC,QAAQC,IAAIF"}

sources is ["?"] while it should be ["app.js"] (= the input file to uglify). vinyl-sourcemaps-apply needs a valid source map to be able to work correctly.

You can fix it by setting sources to file.relative (= the input file) on the source map generated by uglify before passing it to vinyl-sourcemaps-apply.

Which ticket do you mean that I didn't reply to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants