使用Browserify和Uglify与Babelify
我试图来缩小我main.js
上bundle.js
使用Browserify和丑化它的工作好做这样的:
browserify assets/js/main.js | uglifyjs > assets/bundle.js
但现在我在ES6中有依赖关系,我需要使用Babelify而使用Uglify和Babelify?
这样做不起作用:
browserify assets/js/main.js | uglifyjs > assets/bundle.js -t [ babelify --presets [ es2015 react ] ]
我收到错误:
ERROR: ENOENT: no such file or directory, open 'babelify'
at Error (native)
at Object.fs.openSync (fs.js:641:18)
at Object.fs.readFileSync (fs.js:509:33)
at read_file (/usr/local/lib/node_modules/uglify-js/bin/uglifyjs:303:19)
at /usr/local/lib/node_modules/uglify-js/bin/uglifyjs:151:37
at Array.forEach (native)
at Object.<anonymous> (/usr/local/lib/node_modules/uglify-js/bin/uglifyjs:150:31)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
我该如何解决它?
试试这个怎么样?
browserify assets/js/main.js -t [ babelify --presets [ es2015 react ] ] | uglifyjs > assets/bundle.js
链接地址: http://www.djcxy.com/p/5645.html