Skip to content

Commit

Permalink
fix: errors from less (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Dec 28, 2020
1 parent 78befcd commit ce31aca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/LessError.js
Expand Up @@ -8,9 +8,11 @@ class LessError extends Error {
"\n",
...LessError.getFileExcerptIfPossible(error),
error.message.charAt(0).toUpperCase() + error.message.slice(1),
` Error in ${path.normalize(error.filename)} (line ${
error.line
}, column ${error.column})`,
error.filename
? ` Error in ${path.normalize(error.filename)} (line ${
error.line
}, column ${error.column})`
: "",
].join("\n");

this.hideStack = true;
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -43,7 +43,7 @@ async function lessLoader(source) {
result = await less.render(data, lessOptions);
} catch (error) {
if (error.filename) {
// `less` return forward slashes on windows when `webpack` resolver return an absolute windows path in `WebpackFileManager`
// `less` returns forward slashes on windows when `webpack` resolver return an absolute windows path in `WebpackFileManager`
// Ref: https://github.com/webpack-contrib/less-loader/issues/357
this.addDependency(path.normalize(error.filename));
}
Expand Down

0 comments on commit ce31aca

Please sign in to comment.