Skip to content

sourcemaps are broken and this can throw with the latest PostCSS version #89

Open

Description

@romainmenke

The easiest way to reproduce the issue is to take test/html.js and set map to inline around line 59 :

.process(html, {
	syntax,
	from: "append.html",
	map: {
		inline: true,
	},
})
       stringify for append node:
     Error: Invalid mapping: {"generated":{"column":-1,"line":3},"source":"append.html","original":{"column":0,"line":6},"name":null}
      at SourceMapGenerator.SourceMapGenerator_validateMapping [as _validateMapping] (node_modules/source-map-js/lib/source-map-generator.js:298:13)
      at SourceMapGenerator.SourceMapGenerator_addMapping [as addMapping] (node_modules/source-map-js/lib/source-map-generator.js:110:12)

I can not recreate this error with PostCSS alone.
So it seems to be a bug in postcss-html.

Before this change sourcemaps would also be broken and would contain <no source>.

I tried to look for an obvious source and/or solution but I don't know the codebase here and didn't spot anything.


Workaround for users :

  • disable sourcemaps
  • they were broken anyway

Activity

  1. added
    bug
    on Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions