简体   繁体   English

包含的jQuery在生产模式下不起作用引发`not a function`错误

[英]Included jQuery not works under production mode raise `is not a function` error

I put the jquery.placeholder.js under assets/javascripts folder 我将jquery.placeholder.js放在assets/javascripts文件夹下

then apply the function in my coffeescript file and works fine. 然后在我的coffeescript文件中应用该功能,即可正常工作。

$(document).ready ->
  $('input, textarea').placeholder();

However, When I run in production mode by RAILS_ENV=production rails s 但是,当我通过RAILS_ENV=production rails s在生产模式下运行时

Raise not a function error on Firebug console 在Firebug控制台上引发not a function error 在此处输入图片说明

I put other related files on gist 我把其他相关文件放在要点上

https://gist.github.com/poc7667/7576566 https://gist.github.com/poc7667/7576566

取消注释行:config / enviroments / production.rb中为50,并在其中添加jquery.placeholder.js以对其进行预编译

config.assets.precompile += %w( jquery.placeholder.js )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在webpack生产模式下发生错误,但在开发模式下运行良好 - An error happens in webpack production mode, but but works well at development mode 流星错误:无此功能:仅在生产模式下 - Meteor Error: No such function: only in production mode 在生产中出现此错误,但在开发中工作正常 - StripeInvalidRequestError: The `line_items` parameter is required in payment mode - Getting this error in production but works fine in development - StripeInvalidRequestError: The `line_items` parameter is required in payment mode javascript函数仅适用于第一个包含的函数 - javascript function only works with the first included function jQuery.load()在Firefox下响应错误,在Chrome下运行正常 - jQuery.load() responds with error under Firefox, works fine under Chrome 为什么这个 jQuery.ajax 不会引发错误? - Why does this jQuery.ajax not raise an error? 未来日期提出错误jquery ui datepicker - future dates raise error jquery ui datepicker jQuery添加表单,可在JSFiddle上工作,但在生产中无法使用 - Jquery adding forms, works on JSFiddle but in production does not Rails:jQuery在localhost上有效,但在Heroku上不可用 - Rails: jQuery works in localhost but not in production on heroku dataTable引发错误未捕获的TypeError:未定义不是函数 - dataTable raise error Uncaught TypeError: undefined is not a function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM