Bower, brunch, sourcemaps and debugging

I have a bower/brunch project that looks like this:

myproject
    assets
       index.html
    app
       models
       views
       ...
       config.coffee
       config-local.coffee

       application.coffee
    public

       javascripts
           app.js
           app.js.map

       index.html
....


All of the CoffeeScript code from myproject/app is compiled into a single app.js file in the public/javascripts directory. It has a corresponding sourcemap file that looks like this:

{
  "version":3,
  "file":"public/javascripts/app.js",
  "sources":["app/application.coffee","app/config-local.coffee","app/config.coffee"
....


It's served from the http://localhost/, i.e. app.js has an url http://localhost/javascripts/app.js

Is there a way to use IDEA's debugger with this source code structure? I can patch the generated sourcemaps if required, but changing the project structure is not really feasible.

1 comment

Hello!

try making the paths in your map either absolute or relative to your .map file, like:

{
  "version":3,
  "file":"app.js",
  "sources":["../../app/application.coffee","
../../
app/config-local.coffee","
../../
app/config.coffee" ....


and make sure to add the //# sourceMappingURL comment to your app.js file - does this help?

0

Please sign in to leave a comment.