Skip to content

Empty source map causes sources to be unset #116

Open
@dummdidumm

Description

@dummdidumm

When combining source maps, and one of the maps is empty, the sources array is empty afterwards.

[
  {
    version: 3,
    names: [],
    sources: [ '..path/to/$layout.svelte' ],
    sourcesContent: [ '<p>asd</p>\r\n' ],
    mappings: ';;;;;;;'
  },
  {
    version: 3,
    mappings: 'AAAA,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;',
    names: [],
    sources: [ '$layout.svelte' ]
  }
]

It produces { version: 3, mappings: ';;;;;;;', names: [], sources: [] } (note the empty sources array. Mappings is also empty, not sure if that is intended).

Digging into the source code, I think that in this function the combination is done, and the line where sources is updated is never reached in case of empty mappings.

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