Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const minify = getMinifier(this._config.minifierPath);
try {
const minified = minify({
code,
map: sourceMap,
filename,
reserved,
config: this._config.minifierConfig,
});
return {
code: minified.code,
map: minified.map
? toBabelSegments(minified.map).map(toSegmentTuple)
: [],
};
} catch (error) {
if (error.constructor.name === 'JS_Parse_Error') {
throw new Error(
`${error.message} in file ${filename} at ${error.line}:${error.col}`,
);
}
throw error;
}
}