Skip to content

Warnings show incorrect file info (css string with map file) #1388

@glenn2223

Description

@glenn2223

My issue is specifically related to the grid: "autoplace" option. But I'd imagine it applies anywhere a warning is raised.

Actual warning snippet:

  • Line: 1
  • Column: 10
  • File: c:\Path\Sample\_AutoprefixExample\File-With-Import.scss (from node.source.input.file)

Expected warning snippet:

  • Line: 2
  • Column: 4
  • File: c:\Path\Sample\_AutoprefixExample\_import-me.scss

Code

const 
    prefixer = postcss(
            autoprefixer({
                overrideBrowserslist: [
                    '> 0.5%'
                    'last 2 versions'
                    'Firefox ESR'
                    'not dead'
                ],
                grid: "autoplace",
            })
        ),
    result = 
        await prefixer.process(
            "div.Test{grid-template-columns:1fr 3fr}",
            {
                from: 'c:\\Path\\Sample\\_AutoprefixExample\\File-With-Import.scss',
                to: 'c:\\Path\\Sample\\Assets\\Style\\File-With-Import.css',
                map: {
                    inline: false,
                    prev: map, // <-- See map below
                },
            }
        );

result.warnings().forEach((warn) => {
    const
        file = warn.node.source.input.file,
        line = warn.line,
        column = warn.column;
});

MAP

{
    "version":3,
    "sourceRoot":"",
    "sources":["../../_AutoprefixExample/_import-me.scss"],
    "names":[],
    "mappings":"AAAA,SACI",
    "file":"file:///c:/Path/Sample/_AutoprefixExample/File-With-Import.css"
}

File-With-Import.scss

@import 'import-me'

_import-me.scss

div.Test {
    grid-template-columns: 1fr 3fr;
}

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