0

I have gulpfile.babel.js:

function javascript() {
  return gulp.src(PATHS.javascript)
    .pipe($.sourcemaps.init())
    .pipe($.babel())
    .pipe($.concat('app.js'))
    .pipe($.if(PRODUCTION, $.uglify()
      .on('error', e => { console.log(e); })
    ))
    .pipe($.if(!PRODUCTION, $.sourcemaps.write()))
    .pipe(gulp.dest(PATHS.dist + '/assets/js'));
}

Config.xml

PATHS:
  # Paths to JavaScript libraries, which are compined into one file
  javascript:
   - "node_modules/gsap/src/uncompressed/TweenMax.js"
   - "bower_components/scrollmagic/scrollmagic/uncompressed/ScrollMagic.js"

I need to do for this: - 1 Answer of Stackoverflow

When using Babel 6 and babel-preset-es2015 (or Babel 5), Babel by default assumes that files it processes are ES6 modules. The thing that is causing you trouble is that in an ES6 module, this is undefined, whereas in the "script" case, this varies depending on the environment, like window in a browser script or exports in CommonJS code.

For this problem:

Community
  • 1
  • 1
York Xtrem
  • 58
  • 1
  • 10
  • 2
    So you're saying you have some ES6 modules and some non-ES6 modules and you want to compile them differently? Or are you saying you only want to compile certain files and ignore the others? – Mike Cluck Oct 27 '16 at 22:23
  • Yes, I only want to compile certain files and ignore the others. But keeping the sourcemaps of all. – York Xtrem Oct 27 '16 at 22:38
  • I think you would need a separate gulp task to then concat the additional 3rd party files with your transpiled code. As long as your code has sourcemaps it shouldn't be a problem, no? – JR Halchak Oct 18 '17 at 13:32

0 Answers0