Skip to content


simple "make" utility. ideas welcome.
For now, write a Makefile.uglify.js file with contents like this:

      files: [
        { name: "foo.js", module: "Foo" },
        { name: "bar.js", hide: true }

If you run uglifyjs --make it will read and compress foo.js and wrap it like

    (function(){ return this })().Foo = (function(exports, global){
        ... compressed contents of foo.js ...
    })({}, (function(){ return this })());

as for bar.js it'll wrap like this:

        ... compressed contents of bar.js ...

Both of them are concatenated and returned.

The "module" is thus useful to use libraries designed for a CommonJS
environment in browser.

This is just a quick hack as I needed it fast, but the plan is to evolve
it—handle compressor options in the Makefile, additional possibilities to
wrap the files, maybe handle require(...).


transform a["123"] into a[123] (fixes #107)


keep the first token in ast_walker, ast_add_scope and ast_mangle (use…
…ful for

the case where we include the original token in the AST, see parse())


fixed doc rendering for github
Something went wrong with that request. Please try again.