1 | const uglifyJS = require('uglify-js')
|
2 |
|
3 | module.exports = function uglify (content, file, config) {
|
4 | let keywords = ['module', 'exports', 'require', 'Object', 'Array', 'RegExp'].filter((key) => content.indexOf(key) > -1)
|
5 | return uglifyJS.minify('(function(' + keywords.join(',') + '){\n' + content + '\n})(' + keywords.join(',') + ')', config)
|
6 | }
|