Tag: uglifyjs

应该Rails uglifier uglify(mangle)函数名吗?

我的.js文件被压缩并且变量被破坏,但函数名称没有在Heroku上被破坏(运行最新的Rails 3.2.8和最新的uglify 1.3.0 gem)。 根据https://github.com/lautis/uglifier#usage,“mangle ”选项默认为true。 以下是我的配置。 来自production.rb: config.assets.compress = true config.assets.js_compressor = :uglifier 我也试过了 config.assets.compress = true config.assets.js_compressor = Uglifier.new(:mangle => true, :toplevel => true, :copyright => true) 但没有明显的区别。 正如一位评论者建议的那样,我确实尝试更改我的.js文件的内容,但没有任何区别。 Heroku上压缩的预编译.js文件的输出示例: show_slideout_notification=function(){jQuery(“.slideout_notification”).slideDown();var e=$(“.slideout_notification .countdown 似乎变量名称被修改,但函数名称不是。 任何想法为什么函数名称没有被破坏? 或者这是不想要的行为,因为从我的Rails / js代码(即javascript onclick事件)调用函数是很困难的。 或者,如果function名称被破坏,那些onclick调用是否也会被重命名为受损名称? 谢谢 :-)

Rails 5 Heroku部署错误:ExecJS :: ProgramError:SyntaxError:意外的令牌:name(autoRegisterNamespace)

当尝试将rails 5应用程序部署到heroku时,我遇到以下错误,当它到达Running: rake assets:precompile : remote: ExecJS::ProgramError: SyntaxError: Unexpected token: name (autoRegisterNamespace) (line: 14767, col: 7, pos: 457487) remote: Error remote: at new JS_Parse_Error (:3623:11948) remote: at js_error (:3623:12167) remote: at croak (:3623:21858) remote: at token_error (:3623:21995) remote: at unexpected (:3623:22083) remote: at semicolon (:3623:22601) remote: at simple_statement (:3623:25779) remote: at :3623:23567 remote: at :3623:22774 […]