I have an issue when precompiling to Heroku and I checked on Stack overflow to find a debug method which is:
JS_PATH = "app/assets/javascripts/**/*.js";
Dir[JS_PATH].each do |file_name|
puts "\n#{file_name}"
puts Uglifier.compile(File.read(file_name))
end
When I run rail console with this command, it gives me an error in application.js which is
app/assets/javascripts/application.js
ExecJS::RuntimeError: SyntaxError: Unexpected token: punc ())
from get@(execjs):3538:630
The following is my application.js file which i am trying to load the page when someone make a selection from subject list or enter something in the course field. The program works perfectly when running locally but fails to deploy on Heroku. Could you please tell me where I make the run toke cuz I really cannot find it.
//= require jquery3
//= require rails-ujs
//= require turbolinks
//= require_tree .
//= require tether
//= require popper
//= require bootstrap
$(document).on('turbolinks:load', () => {
$('#course').on('input', function() {
if (this.value.length > 1) Rails.fire($('.search-form')[0], 'submit')
})
$('#subject').on('change', () => Rails.fire($('.search-form')[0], 'submit'))
})