vigetlabs / blendid

A delicious blend of gulp tasks combined into a configurable asset pipeline and static site builder
MIT License
4.97k stars 680 forks source link

Build issue: UglifyJs - Unexpected token: name (context) #565

Closed hellojere closed 6 years ago

hellojere commented 6 years ago

Jumped back to an older Ruby on Rails project that runs on Blendid and without doing anything to my own code I started getting the following during the build to production:

gulp-notify: [Error running Gulp] Error:
app-db772911ddfbfa40329a.js from UglifyJs
Unexpected token:
name (context) [app-db772911ddfbfa40329a.js:67035,12]

I even tried a fresh clean install with Blendid, but no luck there.

As far as I've understood this is an UglifyJS issue, and more specifically an ES6 one, but have tried all the examples available without any luck.

My task-config.js is the following:

module.exports = {
  html: false,
  images: true,
  fonts: true,
  svgSprite: true,
  stylesheets: true,

  browserSync: {
    proxy: 'localhost:3000',
    files: ['app/**/*'],
    snippetOptions: {
      rule: {
        match: /<\/head>/i,
        fn: function(snippet, match) {
          return snippet + match;
        }
      }
    }
  },

  javascripts: {
    publicPath: '/assets/javascripts',
    entry: {
      app: ['./app.js']
    },
    babel: {
      presets: ['react-app']
    },
    provide: {
      $: 'jquery',
      jQuery: 'jquery'
    }
  }
};

What would be the solution to get this back running again?