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.
Questions tagged [uglifyjs]
847 questions
30
votes
4 answers
Webpack bundles my files in the wrong order (CommonsChunkPlugin)
What I want is to bundle my JavaScript vendor files in a specific order via CommonsChunkPlugin from Webpack.
I'm using the CommonsChunkPlugin for Webpack. The usage from the official documentation is straight forward and easy. It works as intended…

Ollie Cee
- 704
- 1
- 6
- 14
28
votes
2 answers
How to minify and factor-bundle files in the same browserify command?
I currently have this factor-bundle command which I use to bundle my files, and pull everything common into a common file:
browserify index.js bar-charts.js list-filter.js dashboard.js
-p [ factor-bundle -o ../../static/js/index.js -o…

Richard
- 62,943
- 126
- 334
- 542
27
votes
2 answers
How to exclude certain requireJS files from uglifying/optimizing
I have a working requirejs project that is using grunt for building and deployment. If using no optimization at all, the build is working without problems and I get one big js file to deploy it on production.
The problem I have is, that I have some…

Marco Rinck
- 738
- 2
- 6
- 17
26
votes
2 answers
Does grunt-contrib-uglify not parse "let" keywords?
I am getting an error,
'Unexpected token: name (bazz)'
when my grunt task is running uglify.
The only thing I noticed on that line was that I was using the 'let' keyword instead of 'var', so I wasn't sure why that error was getting thrown.
I…

Michael M
- 466
- 2
- 7
- 14
23
votes
2 answers
Gulp ngmin + uglify not working properly
I have the following gulp task:
gulp.task('scripts', function() {
return gulp.src(['app/js/app.js', 'app/config/config.js', 'app/js/controllers.js', 'app/js/directives.js' , 'app/js/filters.js', 'app/js/footer.js',
…

Oleg Belousov
- 9,981
- 14
- 72
- 127
22
votes
4 answers
ngAnnotate - Warning: StringMap expected string key
I get this warning when using Grunt and grunt-ng-annotate.
There is no reference in the warning to where the error is in the file, which makes debugging it hard.
Any ideas?

iss42
- 2,720
- 3
- 21
- 37
22
votes
1 answer
How to combine TypeScript code and JS libraries into one file with source maps?
I can successfully compile my TypeScript project into a single JS file with source maps using something like this:
tsc --sourcemap --out app.js app.ts
I can also successfully minify that output using UglifyJS, while keeping source maps…

dumbmatter
- 9,351
- 7
- 41
- 80
22
votes
4 answers
Javascript minification why is false replaced with !1 and true with !0
I'm writing an app using Enyo2 which comes with a minification tool based on UglifyJS.
I've noticed that:
var t = false
is replaced with
var t=!1
The same way true is replaced with !0. I'm sure there is a good explanation for that, I just can't…

Arek S
- 4,239
- 4
- 24
- 33
22
votes
3 answers
Reverse Uglified Javascript Code
I am looking for way (preferably and online site) to a reverse Uglify of some javascript. The Website: http://jsbeautifier.org/ is great for minifed code, but it is does not do a great job for ugly stuff.

Dr.YSG
- 7,171
- 22
- 81
- 139
20
votes
1 answer
How to minify nested properties
I'm using terser-js to minify my code.
The output:
a.prototype.a = ...
a.prototype.b = ...
a.prototype.c = ...
What I want:
var h = a.prototype
h.a = ...
h.b = ...
h.c = ...
Note that I can't write it by hand because the inputs are generated from…

W.H
- 1,838
- 10
- 24
20
votes
2 answers
webpack 4 disable uglifyjs-webpack-plugin
I have had this problem for the last 2 days. So I decided to completely disable uglifyjs-webpack-plugin from webpack build process. I was not able to find anything on webpack 4.

yacine benzmane
- 3,888
- 4
- 22
- 32
20
votes
6 answers
Rails 5 Heroku deploy error: ExecJS::ProgramError: SyntaxError: Unexpected token: name (autoRegisterNamespace)
When trying to deploy a rails 5 app to heroku, I get the following error, when it reaches Running: rake assets:precompile:
remote: ExecJS::ProgramError: SyntaxError: Unexpected token: name (autoRegisterNamespace) (line: 14767, col: 7, pos:…

Niels Kristian
- 8,661
- 11
- 59
- 117
19
votes
3 answers
ERROR in bundle.js from UglifyJs Name expected
I am trying to use UglifyJS to minimize/compress my bundle.js file. When I run webpack -p, I am getting the following:
ERROR in bundle.js from UglifyJs
Name expected [bundle.js:105519,6]
Line 105519 is as follows:
const {M, l, pattern} =…

Colby Cox
- 217
- 1
- 2
- 7
19
votes
3 answers
Does it make sense to do both minify and uglify?
Given that uglification involves some minification in the process, does it still make sense to do both minify and uglify? If yes, should one minify or uglify first? Is it enough to do uglify only? Will the code be more obfuscated if both are done?

guagay_wk
- 26,337
- 54
- 186
- 295
19
votes
1 answer
Disable uglyfying in r.js
I am looking for a way to prevent r.js (RequireJS' optimization script) from ugylyfying our JS-modules to maintain readability for debugging purposes.
I expect the script (running on Node.js by the way) to have some command line option to be…

Leo Selig
- 1,062
- 1
- 16
- 30