Questions tagged [uglifyjs]

Uglifyjs is a general-purpose JavaScript parser/compressor/beautifier toolkit. It is developed on NodeJS, but it should work on any JavaScript platform supporting the CommonJS module system.

Useful links

847 questions
248
votes
2 answers

Excluding files/directories from Gulp task

I have a gulp rjs task that concatenates and uglifies all my custom .JS files (any non vendor libraries). What i am trying to do, is exclude some files/directories from this task (controllers and directives). Heres my tree: - application -…
Oam Psy
  • 8,555
  • 32
  • 93
  • 157
115
votes
3 answers

How to uglify output with Browserify in Gulp?

I tried to uglify output of Browserify in Gulp, but it doesn't work. gulpfile.js var browserify = require('browserify'); var gulp = require('gulp'); var uglify = require('gulp-uglify'); var source =…
Nik Terentyev
  • 2,270
  • 3
  • 16
  • 23
103
votes
9 answers

"Unknown provider: aProvider <- a" How do I find the original provider?

When I'm loading the minified (through UglifyJS) version of my AngularJS application, I get the following error in the console: Unknown provider: aProvider <- a Now, I realize that this is due to variable name mangling. The unmangled version works…
Oliver Salzburg
  • 21,652
  • 20
  • 93
  • 138
82
votes
8 answers

Angular.module minification bug

Having the darnedest time trying to figure out why minification is not working. I have injected via an array object my providers prior the function per numerous suggestions across the web and yet still "Unknown provider: aProvider <- a" Regular: var…
BPWDevelopment
  • 919
  • 1
  • 7
  • 8
78
votes
2 answers

Source maps files in production - Is it safe?

I'm using UglifyJS to minify and uglify my sources, and Sentry to report errors from my production environment. In order to get errors from Sentry, in a readable manner, I need to add source-map Is it safe to do it in production servers, or the…
Ofer Velich
  • 1,959
  • 4
  • 19
  • 24
66
votes
10 answers

Remove console.logs with Webpack & Uglify

I am trying to remove console.logs with Webpack's Uglify plugin but it seems that Uglify plugin that comes bundled with Webpack doesn't have that option, its not mentioned in the documentation. I am initializing uglify from webpack like this: new…
Mladen Petrovic
  • 1,698
  • 1
  • 18
  • 26
64
votes
4 answers

Does it make sense to minify code used in NodeJS?

I was wondering, since Clojure Compiler and UglifyJS not only optimize code for size but also for performance (although I think size is the main priority), would my node.js app run faster if it was minified ? I know it may depend from app, but I'm…
62
votes
2 answers

What's the difference between concat and uglify and minify?

What's the difference between concat, uglify, and minify tasks in grunt? I set up an uglify task for all of my site's javascript tasks, and it seemed to both minify and concatenate them. Grunt's site has a great description for how to configure each…
mheavers
  • 29,530
  • 58
  • 194
  • 315
53
votes
1 answer

How to ignore files grunt uglify

Background I've just started using grunt as of about 30mins ago. So bear with me. But I have a rather simple script going that will look at my js and then compress it all into one file for me. Code "use strict"; module.exports = function (grunt) { …
Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291
51
votes
10 answers

How to minify multiple Javascript files in a folder with UglifyJS?

Hello I'm using uglifyJs to minify my javascript files, it's working well with one file at a time, what I'm loking for is to minify all the javascript files present in a folder called JS into a folder called JSM, to be clear I have 2 files inside my…
OussamaLord
  • 1,073
  • 5
  • 28
  • 39
39
votes
3 answers

Minify multiple files with UglifyJS

Is it possible to compress multiple files with UglifyJS? Something like... uglifyjs -o app.build.js appfile1.js appfile2.js ... Also, I am running Uglify via NodeJS in Windows Command Prompt
jcreamer898
  • 8,109
  • 5
  • 41
  • 56
39
votes
2 answers

Why is it recommended to use concat then uglify when the latter can do both?

I keep seeing the recommendation for making JS files ready for production to be concat then uglify. For example here, in on of Yeoman's grunt tasks. By default the flow is: concat -> uglifyjs. Considering UglifyJS can do both concatenation and…
Francisc
  • 77,430
  • 63
  • 180
  • 276
37
votes
3 answers

Webpack optimize with UglifyJS plugin causes runtime error

I have an isomorphic React application that is bundled via webpack. I have 2 entry points corresponding to 2 bundled file outputs: vendors.js and app.js. When running the webpack-dev-server or when compiling without any optimization flags,…
duncanhall
  • 11,035
  • 5
  • 54
  • 86
36
votes
9 answers

how to minify js files in order via grunt-contrib-uglify?

I have a directory like below: /folder/b.js /folder/jQuery.js /folder/a.js /folder/sub/c.js I want to minify all these js files in one js file in order: jQuery.js -> a.js -> b.js -> c.js Q: 1.How can I do it via grunt-contrib-uglify?(In fact, there…
just4fun
  • 537
  • 1
  • 6
  • 13
32
votes
1 answer

Angular "Unknown Provider" error after minification with Grunt Build in Yeoman app

I'm having problems with grunt build on a Yeoman generated Angular app, using Coffee and Slim, with all libraries up-to-date. (The app was just generated a few days ago with the most recent generator.) grunt build and grunt server both worked fine…
javbotero
  • 423
  • 1
  • 4
  • 4
1
2 3
56 57