gulp-uglify

GulpUglifyError:Unable to minify JavaScript

血红的双手。 提交于 2019-12-03 04:04:42
问题 I am trying to minify my script files for which i am using gulp task runner And I am trying gulp-uglify plugin Code: gulp.task('concat', function() { return gulp.src('app/**/*.js') // .pipe(concat('script.js')) .pipe(uglify()) .pipe(gulp.dest('./dist/')) }); but i am getting error as when i try to run gulp task as gulp concat Any help would be appreciated 回答1: The main error is generated when you're using ES6 format. Use the gulp-uglify-es module instead of 'gulp-uglify' to overcome this

GulpUglifyError:Unable to minify JavaScript

*爱你&永不变心* 提交于 2019-12-02 17:51:54
I am trying to minify my script files for which i am using gulp task runner And I am trying gulp-uglify plugin Code: gulp.task('concat', function() { return gulp.src('app/**/*.js') // .pipe(concat('script.js')) .pipe(uglify()) .pipe(gulp.dest('./dist/')) }); but i am getting error as when i try to run gulp task as gulp concat Any help would be appreciated haouarin The main error is generated when you're using ES6 format. Use the gulp-uglify-es module instead of 'gulp-uglify' to overcome this error. var uglify = require('gulp-uglify-es').default; Note: gulp-uglify-es is no longer being

JavaScript heap out of memory in angular js gulp sourcemap ngannonate with babel

杀马特。学长 韩版系。学妹 提交于 2019-12-02 07:39:17
I am using es6 syntax in my angular JS project but it throws error when run gulp build , search over github and So but some saying this is error due to gulp uglify while some say this is babel issue and other say ng-annonate issue. ubuntu 14.04 node -v : 8.4.0 npm -v : 5.3.0 babel --version : 6.26.0 (babel-core 6.26.0) package.json { "name": "Project", "version": "0.0.0", "dependencies": { "gulp-open": "^2.0.0" }, "scripts": { "test": "gulp test" }, "devDependencies": { "babel": "^6.23.0", "babel-core": "^6.25.0", "babel-preset-es2015": "^6.24.1", "browser-sync": "~2.9.11", "browser-sync-spa":

How to minify ES6 functions with gulp-uglify?

核能气质少年 提交于 2019-11-29 22:12:25
When I run gulp I get the following error: [12:54:14] { [GulpUglifyError: unable to minify JavaScript] cause: { [SyntaxError: Unexpected token: operator (>)] message: 'Unexpected token: operator (>)', filename: 'bundle.js', line: 3284, col: 46, pos: 126739 }, plugin: 'gulp-uglify', fileName: 'C:\\servers\\vagrant\\workspace\\awesome\\web\\tool\\bundle.js', showStack: false } The offending line contains an arrow function: var zeroCount = numberArray.filter(v => v === 0).length I know I can replace it with the following to remedy the minification error: var zeroCount = numberArray.filter

How to minify ES6 functions with gulp-uglify?

妖精的绣舞 提交于 2019-11-28 17:25:38
问题 When I run gulp I get the following error: [12:54:14] { [GulpUglifyError: unable to minify JavaScript] cause: { [SyntaxError: Unexpected token: operator (>)] message: 'Unexpected token: operator (>)', filename: 'bundle.js', line: 3284, col: 46, pos: 126739 }, plugin: 'gulp-uglify', fileName: 'C:\\servers\\vagrant\\workspace\\awesome\\web\\tool\\bundle.js', showStack: false } The offending line contains an arrow function: var zeroCount = numberArray.filter(v => v === 0).length I know I can

Uglify throws Parse error

北战南征 提交于 2019-11-28 09:03:10
When i use gulp-uglify with browserify i get a error events.js:72 throw er; // Unhandled 'error' event ^ Error at new JS_Parse_Error (/home/rkmax/my-project/node_modules/gulp-uglify/node_modules/uglify-js/lib/parse.js:189:18) at js_error (/home/rkmax/my-project/node_modules/gulp-uglify/node_modules/uglify-js/lib/parse.js:197:11) at croak (/home/rkmax/my-project/node_modules/gulp-uglify/node_modules/uglify-js/lib/parse.js:656:9) at token_error (/home/rkmax/my-project/node_modules/gulp-uglify/node_modules/uglify-js/lib/parse.js:664:9) at expect_token (/home/rkmax/my-project/node_modules/gulp

how to uglify javascript classes?

冷暖自知 提交于 2019-11-28 04:01:38
问题 I'm writing basic javascript using the classes syntax and trying to uglify it with gulp, but getting this error: events.js:72 throw er; // Unhandled 'error' event I simply used the example code from mozilla's website: class Polygon { constructor(height, width) { this.height = height; this.width = width; } } And nothing special about my gulp file - works perfectly for any non-class js: // Include gulp var gulp = require('gulp'); // Include Our Plugins var jshint = require('gulp-jshint'); var

Uglify SyntaxError: Unexpected token: punc ())

家住魔仙堡 提交于 2019-11-27 12:33:13
I am trying to use gulp in order to minify a folder containing JS files. However, one of the files has the above error, preventing it from being minified. I managed to catch and print the error, which I've partially printed here: JS_Parse_Error { message: 'SyntaxError: Unexpected token: punc ())', filename: 'ex.js', line: 189, col: 25, pos: 6482, stack: Error\n at new JS_Parse_Error (eval at <anonymous> ... ) plugin: 'gulp-uglify', fileName: '.../js/ex.js', showStack: false } The file in question contains the following, shortened: function() { ... $.confirm({ buttons: { confirm: function() { $

Uglify SyntaxError: Unexpected token: punc ())

﹥>﹥吖頭↗ 提交于 2019-11-26 17:42:59
问题 I am trying to use gulp in order to minify a folder containing JS files. However, one of the files has the above error, preventing it from being minified. I managed to catch and print the error, which I've partially printed here: JS_Parse_Error { message: 'SyntaxError: Unexpected token: punc ())', filename: 'ex.js', line: 189, col: 25, pos: 6482, stack: Error\n at new JS_Parse_Error (eval at <anonymous> ... ) plugin: 'gulp-uglify', fileName: '.../js/ex.js', showStack: false } The file in