Skip to content

Commit

Permalink
feat(plugin-uglify): 强力压缩 (NervJS#1294)
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxingchen authored and jiangzm committed Dec 7, 2020
1 parent db5ba27 commit 6b7ec06
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/taro-plugin-uglifyjs/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const uglifyJS = require('uglify-js')

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

0 comments on commit 6b7ec06

Please sign in to comment.