sprockets
sprockets copied to clipboard
Wrong map error position with ERB preprocessor
JS with ERB preprocessor generate map which display wrong error position.
bugsnag-js.js.erb
:
<% if Rails.env.production? %>
window.bugsnagClient = bugsnag({
apiKey: "KEY",
autoNotify: true
});
<% end %>
example.coffee
:
window.test = 1
window.test = 2
window.test = 4
window.test = d
Displays wrong error position:
d is not defined
application/example.source.coffee:3:14
To fix this I should use inline ERB, like bugsnag-js.coffee.erb
:
if <%= Rails.env.production? %>
window.bugsnagClient = bugsnag('KEY')
System configuration
- Sprockets 4.0.0.beta8
- Ruby 2.4.3