Skip to content

Commit 073845b

Browse files
committed
Fix: Autoprefixer warning saying undefined before line:column
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)
1 parent f83d11d commit 073845b

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/SassCompileHelper.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ export class SassHelper {
3636
},
3737
};*/
3838

39-
if (generateMap) data.sourceMap = mapFileUri;
40-
else data.omitSourceMapUrl = true;
39+
data.sourceMap = mapFileUri;
40+
41+
if (!generateMap) data.omitSourceMapUrl = true;
4142

4243
try {
4344
return { result: compiler.renderSync(data), errorString: null };

src/appModel.ts

+15-14
Original file line numberDiff line numberDiff line change
@@ -467,24 +467,25 @@ export class AppModel {
467467
overrideBrowserslist: browsers,
468468
grid: "autoplace",
469469
})
470-
),
471-
options: ProcessOptions = generateMap
472-
? {
473-
from: filePath,
474-
to: savePath,
475-
map: {
476-
inline: false,
477-
prev: map,
478-
},
479-
}
480-
: {};
481-
482-
const result = await prefixer.process(css, options);
470+
);
471+
472+
const result =
473+
await prefixer.process(
474+
css,
475+
{
476+
from: filePath,
477+
to: savePath,
478+
map: {
479+
inline: false,
480+
prev: map,
481+
},
482+
}
483+
);
483484

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

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

0 commit comments

Comments
 (0)