Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
rollup-plugin-uglify
Advanced tools
Rollup plugin to minify generated bundle. Uses UglifyJS under the hood. There are a few improvements over native uglify:
Note: uglify-js is able to transpile only es5 syntax. If you want to transpile es6+ syntax use terser instead
yarn add rollup-plugin-uglify --dev
Note: this package requires rollup@0.66 and higher
import { rollup } from "rollup";
import { uglify } from "rollup-plugin-uglify";
rollup({
input: "main.js",
plugins: [uglify()]
});
uglify(options);
options
- uglifyJS API options
options.sourcemap: boolean
Generates source maps and passes them to rollup. Defaults to true
.
options.numWorkers: number
Amount of workers to spawn. Defaults to the number of CPUs minus 1.
If you'd like to preserve comments (for licensing for example), then you can specify a function to do this like so:
uglify({
output: {
comments: function(node, comment) {
if (comment.type === "comment2") {
// multiline comment
return /@preserve|@license|@cc_on/i.test(comment.value);
}
return false;
}
}
});
Alternatively, you can also choose to keep all comments (e.g. if a licensing header has already been prepended by a previous rollup plugin):
uglify({
output: {
comments: "all"
}
});
See UglifyJS documentation for further reference.
MIT © Bogdan Chadkin
FAQs
Rollup plugin to minify generated bundle
We found that rollup-plugin-uglify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.