Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const minifyBabel = ({ settings, content, callback, index }) => {
let babelOptions = {
presets: []
};
if (settings.options.babelrc) {
babelOptions = JSON.parse(utils.readFile(settings.options.babelrc));
}
if (settings.options.presets) {
const babelrcPresets = babelOptions.presets || [];
babelOptions.presets = babelrcPresets.concat(settings.options.presets);
}
if (babelOptions.presets.indexOf('minify') === -1) {
babelOptions.presets = babelOptions.presets.concat([minify]);
}
const contentMinified = transform(content, babelOptions);
if (!settings.content) {
utils.writeFile({ file: settings.output, content: contentMinified.code, index });
}
if (callback) {