Skip to content

Incomplete Sourcemap with Gulp, Rollup, Babel #56

@ftaiolivista

Description

@ftaiolivista

I'm having trouble obtaining a good sourcemap using this Gulp configuration.

gulp.task('scripts', () => {
  return gulp.src('app/scripts/**/*.js')
    .pipe($.plumber())
    .pipe($.sourcemaps.init())
    .pipe(
        $.rollup(
            {               
                plugins: [
                    babel(
                        {
                            babelrc: false,
                            presets: ["es2015-rollup"],
                            exclude: 'node_modules/**',
                            plugins: [
                                  ["transform-react-jsx", {
                                       "pragma": "m"
                                  }]
                            ]
                        }
                    )
                ],
                entry: './app/scripts/main.js'
            }
        )
    )
    .pipe($.sourcemaps.write('.'))
    .pipe(gulp.dest('.tmp/scripts'))
    .pipe(reload({stream: true}));
});

The main.js is a simple script that import local file

'use strict';

import Application from './framework/Application.js';

code...

But the sourcemap I got is this:
{"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":";< ... many ';' here ... >;"}
Npm dev package installed


"babel-core": "^6.4.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2015-rollup": "^3.0.0",
"babel-register": "^6.5.2",
"browser-sync": "^2.2.1",
"del": "^2.2.0",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.0.1",
"gulp-babel": "^6.1.1",
"gulp-cache": "^0.4.2",
"gulp-cssnano": "^2.0.0",
"gulp-eslint": "^3.0.0",
"gulp-filter": "^4.0.0",
"gulp-htmlmin": "^3.0.0",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^3.0.1",
"gulp-load-plugins": "^1.2.4",
"gulp-plumber": "^1.0.1",
"gulp-rollup": "^2.11.0",
"gulp-sass": "^2.0.0",
"gulp-size": "^2.1.0",
"gulp-sourcemaps": "^2.2.0",
"gulp-uglify": "^2.0.0",
"gulp-useref": "^3.0.0",
"main-bower-files": "^2.5.0",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"run-sequence": "^1.2.2",
"wiredep": "^4.0.0"

Any ideas?

Strack overflow question

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions