Skip to content

Questions about file, sources, and sourceRoot #340

Closed
@npetruzzelli

Description

@npetruzzelli

I had a look at https://github.com/mozilla/source-map/blob/master/CONTRIBUTING.md#filing-issues but couldn't find any guidelines for simply asking questions. I'll try to be as thorough as I can.

I've been looking at the following:

In trying to determine why it is so difficult to get source maps to work in an expected way with webpack, I noticed a few things about some of these node packages. I'd like to confirm that I understand how source maps work before I open up issues in these repos or attempt putting the time into creating pull requests of my own for them.

Basically, I don't want to criticize someone else if I might be wrong.

My reference is: Source Map Revision 3 Proposal


Question 1: Types for sourceRoot and sources

Can you confirm that both the sourceRoot string and sources array are intended to contain URLs, and NOT file system paths (POSIX, Windows, or otherwise)? If not, what am I missing?

Question 2: Is sourceRoot optional? Always?

  • Is sourceRoot being undefined or an empty string, valid? It just means that nothing is prepended to sources, correct?
  • No plugin/module/software working with source maps should define this field if the developer left it empty, correct?

Question 3: Is null a valid value for sourceRoot?

For my own reference. Is it treated the same as being undefined?

Question 4: Is file intended to be just the file name?

Meaning no path information. Just the name and extension.

Question 5: Is there a central registry for extensions?

Extra properties on a map whose property names begin with x_.


Primarily, I intend to dive deeper into sass-loader and postcss-loader as they seem to be using file system paths instead of URLs, and that could be the source of some of the problems I'm running into.

I'm trying to contribute to: webpack-contrib/css-loader#652 (comment), which I don't have enough information to do properly and my existing post is not as well informed as I'd like it to be.

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