Skip to content

CLI: Setting sourceRoot option removes folder structure #3075

@cr0

Description

@cr0

Hi there

is it on purpose that setting the sourceRoot option removes the coffee files' folder structure from the generated source map?

With sourceRoot set to coffee/

./assets/coffee/lib/utils.coffee

the generated source map at ./public/js/lib/utils.map will be:

"sourceRoot": "/coffee/",
"sources": [
     "utils.coffee"
]

This makes Chrome unable to find the attached coffee file for a javascript file. As you can see on the attached file the old folder structure is completely removed.
flat-structure
So Chrome reconstructs the folder structure based on the source maps wrong. This makes it impossible for me to debug things because every request for a coffee file in a subfolder ends in a 404.

I'm using grunt to build:

coffee:
  client:
    options:
      sourceMap: true
      sourceRoot: '/coffee/'
    files: [
      expand:   true
      cwd:      'assets/coffee/'
      src:      ['**/*.coffee']
      dest:     'public/js/'
      ext:      '.js'
    ]

Is something wrong with my build setup? Or is this a bug (or a feature ;))? I'm on 1.6.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions