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 - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

31

index.js

@@ -1,21 +0,22 @@

const minify = require('uglify-js').minify;
const minify = require("uglify-es").minify;
function uglify(userOptions, minifier) {
if (minifier === undefined) {
minifier = minify;
if (minifier === undefined) {
minifier = minify;
}
const options = Object.assign({ sourceMap: true }, userOptions);
return {
name: "uglify",
transformBundle(code) {
const result = minifier(code, options);
if (result.error) {
throw result.error;
}
return result;
}
const options = Object.assign({ sourceMap: true }, userOptions);
return {
name: 'uglify',
transformBundle(code) {
const result = minifier(code, options);
if (result.error) {
throw result.error;
}
return result;
}
};
};
}
module.exports = uglify;
{
"name": "rollup-plugin-uglify",
"version": "2.0.1",
"version": "3.0.0",
"description": "Rollup plugin to minify generated bundle",

@@ -10,3 +10,3 @@ "main": "index.js",

"scripts": {
"test": "jest --coverage",
"test": "jest",
"prepublish": "yarn test"

@@ -27,8 +27,9 @@ },

"dependencies": {
"uglify-js": "^3.0.9"
"uglify-es": "^3.3.7"
},
"devDependencies": {
"jest": "^20.0.3",
"rollup": "^0.41.6"
"jest": "^22.1.4",
"prettier": "^1.10.2",
"rollup": "^0.54.1"
}
}

@@ -36,27 +36,4 @@ # rollup-plugin-uglify [![Travis Build Status][travis-img]][travis]

`minifier` – default: `require('uglify-js').minify`, type: `function`. Module to use as a minifier. You can use other versions (or forks) of UglifyJS instead default one.
`minifier` – default: `require('uglify-es').minify`, type: `function`. Module to use as a minifier. You can use other versions (or forks) of UglifyJS instead default one.
## Warning
[UglifyJS](https://github.com/mishoo/UglifyJS2), which this plugin is based on, does not support the ES2015 module syntax. Thus using this plugin with Rollup's default bundle format (`'es'`) will not work and error out.
To work around this you can tell `rollup-plugin-uglify` to use the UglifyJS [unstable es version](https://github.com/mishoo/UglifyJS2) by passing its `minify` function to minify your code.
```js
import { rollup } from 'rollup';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-es';
rollup({
entry: 'main.js',
plugins: [
uglify({}, minify)
]
});
```
To install the experimental version of UglifyJS:
```
npm i uglify-es -D
```
## Examples

@@ -83,2 +60,12 @@

Alternatively, you can also choose to keep all comments (e.g. if a licensing header has already been prepended by a previous rollup plugin):
```js
uglify({
output: {
comments: 'all'
}
});
```
See [UglifyJS documentation](https://github.com/mishoo/UglifyJS2#keeping-comments-in-the-output) for further reference.

@@ -85,0 +72,0 @@

Sorry, the diff of this file is not supported yet

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