Skip to content

Problem with hard-coded sourceRoot #373

Closed
@RandScullard

Description

@RandScullard

I'm using css-loader (with sass-loader), and I'm finding that CSS source maps are not working in Chrome or Firefox. The generated CSS is being dynamically inserted by style-loader, and in the Chrome developer tools Styles panel, all of the source links look like this:

blob:http://localhost:8080/022723dd-255f-4c67-8da3-486c82cba226

When clicked, these links take me to the generated CSS and not the original source SCSS file.

It seems as if this problem is related to the hard-coded sourceRoot being set by css-loader (https://github.com/webpack/css-loader/blob/master/lib/loader.js#L106):

map.sourceRoot = "webpack://";

Chrome doesn't seem to know how to interpret this and find the source files, and I can't see any way to override this sourceRoot, so I tried temporarily changing that line of code to this:

map.sourceRoot = "http://localhost:8080";

...and the source maps started working. Am I missing something or is this a problem with css-loader?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions