Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.json文件没有指定模块uglify-js的版本号 #131

Open
leizongmin opened this issue Mar 14, 2013 · 3 comments
Open

package.json文件没有指定模块uglify-js的版本号 #131

leizongmin opened this issue Mar 14, 2013 · 3 comments

Comments

@leizongmin
Copy link

package.json 文件中没有指定模块uglify-js的版本号,这个模块的新版本2.x跟1.x的API不一样,运行 node bin/build.js 时如果加了压缩代码的选项会出错。

uglify-js 新版本压缩代码的例子:

var result = UglifyJS.minify("/path/to/file.js");
console.log(result.code); // minified output
// if you need to pass code instead of file name
var result = UglifyJS.minify("var b = function () {};", {fromString: true});

参考:https://github.com/mishoo/UglifyJS

@JacksonTian
Copy link
Contributor

收到。

@JacksonTian
Copy link
Contributor

不过我的脚本中貌似没有加压缩选项丫。你是改动了脚本发现的问题吗

@leizongmin
Copy link
Author

我把源码中的var output = minify ? exports.minify(unminified) : unminified; 直接改成了var output = exports.minify(unminified);,发现运行的时候出错了。
原因是运行npm install时,默认会安装最新版的uglify-js。
虽然原来的程序运行时不会出错,但是这始终是个隐患。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants