You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
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
npmnpm
Version published
Weekly downloads
112K
-56.23%
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

rollup

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