Questions tagged [uglifyjs2]

A general-purpose JavaScript parser/compressor/beautifier toolkit developed on Node.js

112 questions
1
vote
0 answers

Pass parameters from sbt-rjs to uglify

I'm using play! 2.5.8 and I'm minifying my JS files with sbt-rjs that uses uglify2 by default. The minification is very basic (the code is still readable) and I want to improve it. On sbt-uglify's github page, there is a table of minification…
Tom
  • 944
  • 2
  • 15
  • 35
1
vote
1 answer

Uglify and mangle $scope variables and functions

Is there any way to achieve that without breaking the code? I have tried mangleProperties but indeed my code is not working, even after using regex and 'controller as' feature…
A. DC
  • 1,193
  • 2
  • 7
  • 10
1
vote
2 answers

How do you pass the --mangle-regex option to uglify using gulp-uglify?

I'm trying to use the --mange-regex option which is documented on UglifyJS2's GItHub README. The problem is, my build uses gulp-uglify, and it isn't clearly documented how I should use --mangle-regex without the command line. My goal is to mangle…
Bryan Rayner
  • 3,503
  • 3
  • 23
  • 36
1
vote
1 answer

How to Preserve HereDoc-Style Comments Inside Function Using UglifyJS2

I often use empty functions as HereDoc blocks when templating. var heredoc = function() {/*
Hello World!
*/}; The UglifyJS2 compressor removes all comments, which is generally desirable. Except for this one! I thought to use…
Nathan
  • 151
  • 2
  • 16
1
vote
0 answers

How to get actual parameter by formal parameter in UglifyJS's AST?

Given the code: (function(fn){ define(fn); })(function() { return 0; }); I've got the AST_SymbolRef of fn by a tree walker, how can I get the AST_Function of function() { return 0; } by that reference?
Sin
  • 805
  • 1
  • 6
  • 18
1
vote
0 answers

JavaScript source map keep function names

I installed UglifyJS2 in my ASP MVC 4 Project in Visual Studio as command line tool and used it to uglify a js file i wrote. I need to keep the function names as they are so i set --keep-fnames. So far so good after i tried the…
1
vote
1 answer

Can bracket notation be used to compress/obfuscate JavaScript?

This is mainly for academic reasons, but I'm curious as to whether there is anything wrong with extensively using bracket notation over dot notation. Some possible applications may include: further compression by deduplication of commonly used…
integsrtite
  • 605
  • 1
  • 5
  • 6
1
vote
1 answer

Source maps in uglified requirejs project

I have a requirejs project, I'm compiling with grunt-requirejs ("grunt-contrib-requirejs": "~0.4.1") into 1 big file: main.js. This task has source map generation enabled: requirejs: { compile: { options: { baseUrl:…
Dmitry Evseev
  • 11,313
  • 3
  • 31
  • 47
1
vote
0 answers

Setting the --in-source-map uglify2 config option in r.js build config file

I wanted to use the --in-source-map option that is available in UglifyJS2 for consuming a source map file and outputting a new one along with the compressed js, thereby performing a multi-level source mapping. I am using r.js to do the minification…
KonyKing
  • 81
  • 1
  • 7
1
vote
1 answer

sbt-uglify compressOptions not taking?

I have been trying to add in sbt-uglify, which has worked out through trial and error. I find the documentation lacking and Google results not good. This plugin is based on UglifyJS. The issue I am having is the fact that it drops unreachable code…
1
vote
1 answer

Debugger showing wrong information with source maps

This has happened for the second time now and as you can imagine, a debugger that shows wrong information is the worst thing that can happen when debugging. What happens is that when using source maps that debugger thinks the VM is at a certain…
rob
  • 2,498
  • 5
  • 20
  • 37
1
vote
1 answer

r.js disable drop_debugger option

I'm trying to create a build config file for r.js with uglify2 as optimizer. I want to disable the drop_debugger so the debugger statement does not get removed. Below is my build.js file, the build process works fine but the debugger statements have…
Willem D'Haeseleer
  • 17,802
  • 6
  • 58
  • 92
1
vote
3 answers

Is there any Uglify Express Middleware?

I'm trying to find an Express Middleware for Uglify, can you recommend one? It seems like uglify-js-middleware is trying to solve it to Connect, but it seems like it's not maintained anymore and when I tried it, it didn't with Express.
Guy Korland
  • 7,479
  • 12
  • 48
  • 94
0
votes
2 answers

uglify Error: Cannot find module 'optimist'

I am going to uglify index.js file. But it throws this error: Cannot find module 'optimist'. I have installed optimist: npm install optimist but it doesn't work. Anyone can help? uglifyjs index.js module.js:550 throw err; ^ Error: Cannot…
reactnative
  • 187
  • 1
  • 5
  • 10
0
votes
0 answers

uglifyjs command permission denied

I have a strange problem about my uglifyjs command. The uglifyjs file looks like below #!/usr/bin/env /usr/local/bin/node // -*- js -*- "use strict"; require("../tools/exit"); var fs = require("fs"); var info = require("../package.json"); And…
Charles
  • 615
  • 2
  • 11
  • 20