UNPKG
rollup-plugin-uglify
Version:
latest (6.0.4)
6.0.4
6.0.3
6.0.2
6.0.1
6.0.0
5.0.2
5.0.1
5.0.0
4.0.0
3.0.0
2.0.1
2.0.0
1.0.2
1.0.1
1.0.0
0.3.1
0.2.0
0.1.0
Rollup plugin to minify generated bundle
TrySound/rollup-plugin-uglify
rollup-plugin-uglify
/
transform.js
14 lines
(11 loc)
•
287 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
const
{ minify } =
require
(
"uglify-js"
);
const
transform
= (
code, optionsString
) => {
const
options =
eval
(
`(
${optionsString}
)`
)
const
result =
minify
(code, options);
if
(result.
error
) {
throw
result.
error
; }
else
{
return
result; } };
exports
.
transform
= transform;