sprockets icon indicating copy to clipboard operation
sprockets copied to clipboard

Wrong map error position with ERB preprocessor

Open N0xFF opened this issue 6 years ago • 0 comments

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

N0xFF avatar Oct 09 '18 13:10 N0xFF