Gathering detailed insights and metrics for @vendhq/uglifyify
Gathering detailed insights and metrics for @vendhq/uglifyify
npm install @vendhq/uglifyify
Typescript
Module System
Node Version
NPM Version
65.5
Supply Chain
97.3
Quality
82.4
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Total Downloads
16,657
Last Day
1
Last Week
1
Last Month
4
Last Year
124
377 Stars
96 Commits
61 Forks
9 Watching
2 Branches
22 Contributors
Latest Version
5.2.0
Package Id
@vendhq/uglifyify@5.2.0
Unpacked Size
15.45 kB
Size
5.51 kB
File Count
6
NPM Version
6.9.0
Node Version
10.16.3
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
0%
1
Compared to previous week
Last month
-33.3%
4
Compared to previous month
Last year
-37.1%
124
Compared to previous year
4
6
A Browserify v2 transform which minifies your code using terser (a maintained fork of uglify-es).
This fork contains fixes for some longstanding issues including:
1npm install uglifyify
Ordinarily you'd be fine doing this:
1browserify index.js | uglifyjs -c > bundle.js
But uglifyify is able to yield smaller output by processing files individually instead of just the entire bundle. When using uglifyify you should generally also use Uglify, to achieve the smallest output. Uglifyify provides an additional optimization when used with Uglify, but does not provide all of the optimization that using Uglify on its own does, so it's not a replacement.
Uglifyify gives you the benefit of applying Uglify's "squeeze" transform on each file before it's included in the bundle, meaning you can remove dead code paths for conditional requires. Here's a contrived example:
1if (true) { 2 module.exports = require('./browser') 3} else { 4 module.exports = require('./node') 5}
module.exports = require('./node')
will be excluded by Uglify, meaning that
only ./browser
will be bundled and required.
If you combine uglifyify with envify, you can make this a little more accessible. Take this code:
1if (process.env.NODE_ENV === 'development') { 2 module.exports = require('./development') 3} else { 4 module.exports = require('./production') 5}
And use this to compile:
1NODE_ENV=development browserify -t envify -t uglifyify index.js -o dev.js && 2NODE_ENV=production browserify -t envify -t uglifyify index.js -o prod.js
It should go without saying that you should be hesitant using environment
variables in a Browserify module - this is best suited to your own
applications or modules built with Browserify's --standalone
tag.
Sometimes, you don't want uglifyify to minify all of your files – for example,
if you're using a transform to require
CSS or HTML, you might get an error
as uglify expects JavaScript and will throw if it can't parse what it's given.
This is done using the -x
or --exts
transform options, e.g. from the
command-line:
1browserify \ 2 -t coffeeify \ 3 -t [ uglifyify -x .js -x .coffee ]
The above example will only minify .js
and .coffee
files, ignoring the rest.
You might also want to take advantage of uglifyify's pre-bundle minification to produce slightly leaner files across your entire browserify bundle. By default, transforms only alter your application code, but you can use global transforms to minify module code too. From your terminal:
1browserify -g uglifyify ./index.js > bundle.js
Or programatically:
1var browserify = require('browserify') 2var fs = require('fs') 3 4var bundler = browserify(__dirname + '/index.js') 5 6bundler.transform('uglifyify', { global: true }) 7 8bundler.bundle() 9 .pipe(fs.createWriteStream(__dirname + '/bundle.js'))
Note that this is fine for uglifyify as it shouldn't modify the behavior of your code unexpectedly, but transforms such as envify should almost always stay local – otherwise you'll run into unexpected side-effects within modules that weren't expecting to be modified as such.
Sometimes uglifyjs will break specific files under specific settings – it's
rare, but does happen – and to work around that, you can use the ignore
option. Given one or more glob patterns, you can filter out specific files
this way:
1browserify -g [ uglifyify --ignore '**/node_modules/weakmap/*' ] ./index.js
1var bundler = browserify('index.js') 2 3bundler.transform('uglifyify', { 4 global: true, 5 ignore: [ 6 '**/node_modules/weakmap/*' 7 , '**/node_modules/async/*' 8 ] 9}) 10 11bundler.bundle().pipe(process.stdout)
Uglifyify supports source maps, so you can minify your code and still see the original source – this works especially well with a tool such as exorcist when creating production builds.
Source maps are enabled when:
--debug
flag (or debug
option) to your browserify
bundle.Enabling --debug
with browserify is easy:
1browserify -t uglifyify --debug index.js
1var bundler = browserify({ debug: true }) 2 3bundler 4 .add('index.js') 5 .transform('uglifyify') 6 .bundle() 7 .pipe(process.stdout)
If you'd prefer them not to be included regardless, you can opt out
using the sourcemap
option:
1browserify -t [ uglifyify --no-sourcemap ] app.js
1var bundler = browserify('index.js') 2 3bundler.transform('uglifyify', { sourceMap: false }) 4 .bundle() 5 .pipe(process.stdout)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 12/26 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-12-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More