Skip to content

Commit

Permalink
Fix: Autoprefixer warning saying undefined before line:column
Browse files Browse the repository at this point in the history
When `generateMap` is `false` the error returned by autoprefixer was `undefined` instead of the file path.

**Known issue**
Autoprefixer does not honour actual error location (from map). Created [issue](postcss/autoprefixer#1388)
  • Loading branch information
glenn2223 committed Jan 20, 2021
1 parent f83d11d commit 073845b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
5 changes: 3 additions & 2 deletions src/SassCompileHelper.ts
Expand Up @@ -36,8 +36,9 @@ export class SassHelper {
},
};*/

if (generateMap) data.sourceMap = mapFileUri;
else data.omitSourceMapUrl = true;
data.sourceMap = mapFileUri;

if (!generateMap) data.omitSourceMapUrl = true;

try {
return { result: compiler.renderSync(data), errorString: null };
Expand Down
29 changes: 15 additions & 14 deletions src/appModel.ts
Expand Up @@ -467,24 +467,25 @@ export class AppModel {
overrideBrowserslist: browsers,
grid: "autoplace",
})
),
options: ProcessOptions = generateMap
? {
from: filePath,
to: savePath,
map: {
inline: false,
prev: map,
},
}
: {};

const result = await prefixer.process(css, options);
);

const result =
await prefixer.process(
css,
{
from: filePath,
to: savePath,
map: {
inline: false,
prev: map,
},
}
);

result.warnings().forEach((warn) => {
const body: string[] = [];

if (warn.node.source?.input.file !== null) {
if (warn.node.source?.input.file) {
body.push(warn.node.source.input.file + `:${warn.line}:${warn.column}`);
}

Expand Down

0 comments on commit 073845b

Please sign in to comment.