diff --git a/lib/less/tree/debug-info.js b/lib/less/tree/debug-info.js index 096386d11..71424c8dd 100644 --- a/lib/less/tree/debug-info.js +++ b/lib/less/tree/debug-info.js @@ -16,9 +16,10 @@ const debugInfo = (context, ctx, lineSeparator) => { return result; }; -debugInfo.asComment = ctx => `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\n`; +debugInfo.asComment = ctx => ctx.debugInfo ? `/* line ${ctx.debugInfo.lineNumber}, ${ctx.debugInfo.fileName} */\n` : ''; debugInfo.asMediaQuery = ctx => { + if (!ctx.debugInfo) { return ''; } let filenameWithProtocol = ctx.debugInfo.fileName; if (!/^[a-z]+:\/\//i.test(filenameWithProtocol)) { filenameWithProtocol = `file://${filenameWithProtocol}`;