Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-uglify

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-uglify

Rollup plugin to minify generated bundle

  • 6.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
155K
decreased by-56.3%
Maintainers
1
Weekly downloads
 
Created

What is rollup-plugin-uglify?

The rollup-plugin-uglify package is a Rollup plugin that integrates UglifyJS to minify JavaScript code. It helps reduce the size of the output bundle by removing unnecessary whitespace, comments, and other non-essential code elements, making it ideal for production builds.

What are rollup-plugin-uglify's main functionalities?

Basic Minification

This feature allows you to minify your JavaScript code using UglifyJS. The code sample demonstrates how to use the rollup-plugin-uglify to minify a JavaScript file during the Rollup build process.

import { rollup } from 'rollup';
import { uglify } from 'rollup-plugin-uglify';

rollup({
  input: 'src/main.js',
  plugins: [uglify()]
}).then(bundle => {
  return bundle.write({
    file: 'dist/bundle.min.js',
    format: 'iife'
  });
});

Custom UglifyJS Options

This feature allows you to pass custom options to UglifyJS to control the minification process. The code sample shows how to configure the plugin to remove console statements and produce non-beautified output.

import { rollup } from 'rollup';
import { uglify } from 'rollup-plugin-uglify';

rollup({
  input: 'src/main.js',
  plugins: [uglify({
    compress: {
      drop_console: true
    },
    output: {
      beautify: false
    }
  })]
}).then(bundle => {
  return bundle.write({
    file: 'dist/bundle.min.js',
    format: 'iife'
  });
});

Other packages similar to rollup-plugin-uglify

Keywords

FAQs

Package last updated on 11 Dec 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc