GoScrobble/web/node_modules/rollup-plugin-terser/transform.js

14 lines
319 B
JavaScript
Raw Normal View History

2022-04-25 02:47:15 +00:00
const { minify } = require("terser");
const transform = (code, optionsString) => {
const options = eval(`(${optionsString})`);
const result = minify(code, options);
if (result.error) {
throw result.error;
} else {
return { result, nameCache: options.nameCache };
}
};
exports.transform = transform;