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

Cannot uglify on Gulp #66

Open
jcfrane opened this issue Jul 5, 2017 · 1 comment
Open

Cannot uglify on Gulp #66

jcfrane opened this issue Jul 5, 2017 · 1 comment

Comments

@jcfrane
Copy link

jcfrane commented Jul 5, 2017

Hi,

I was trying to uglify my vendor files with gulp.

It produces this error:

GulpUglifyError: unable to minify JavaScript
Caused by: SyntaxError: Unexpected token: name (Commented)

When I tried to remove angular-wamp with my dependency the error is gone.
So I suspect that angular-wamp must be the cause.

Heres my gulp task

//build prod scripts
gulp.task('build', [], function() {

    // build vendors
    var vb = browserify({
        debug: true
    });

    vendors.forEach(function(vendor) {
        vb.require(vendor);
    });

    vb
        .bundle()
        .pipe(source('vendors.js'))
        .pipe(buffer())
        .pipe(uglify({
            mangle: false
        }))
        .pipe(gulp.dest('./web/dist/js/'))
    ;

    var b = browserify({
        entries: './web/app/gol88/app.module.js',
        debug: true,
        paths: ['./web/app/gol88/**/*.js'],
    });

    b.transform(ngAnnotate);

    return b
        .external(vendors)
        .bundle()
        .on('error', swallowError)
        .pipe(source('bundle.js'))
        //.pipe(gAnnotate())
        .pipe(buffer())
        .pipe(uglify({
            mangle: false
        }))
        .on('error', swallowError)
        .pipe(gulp.dest('./web/dist/js/'));
});

Why is that so?

@frankadrian
Copy link

Hi @jcfrane, I also experienced this error and it turns out that the autobahn.js library is making use of ES6 syntax wich the uglifier can not handle. I had to add another step to transpile to ES5 (via babel) and then the minification works!

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

2 participants