From b2b65f945e8a18276b36c91c9f68dac8c5a8818e Mon Sep 17 00:00:00 2001 From: zhanglei55 Date: Tue, 12 Dec 2017 15:13:48 +0800 Subject: [PATCH 1/2] optimize sourceMap warning tip --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index c3b03fbc..77051dc5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -136,7 +136,7 @@ module.exports = function loader (css, map) { css = this.exec(css, this.resource) } - if (!sourceMap && map) { + if (sourceMap === undefined && map) { this.emitWarning(`\n\n ⚠️ PostCSS Loader\n\nPrevious source map found, but options.sourceMap isn't set.\nIn this case the loader will discard the source map entirely for performance reasons.\nSee https://github.com/postcss/postcss-loader#sourcemap for more information.\n\n`) } From a617b4680dda60af204672e0c91f2e734b9ede41 Mon Sep 17 00:00:00 2001 From: zhanglei55 Date: Wed, 13 Dec 2017 15:15:30 +0800 Subject: [PATCH 2/2] improve warning tip --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 77051dc5..9a8e304e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -136,8 +136,8 @@ module.exports = function loader (css, map) { css = this.exec(css, this.resource) } - if (sourceMap === undefined && map) { - this.emitWarning(`\n\n ⚠️ PostCSS Loader\n\nPrevious source map found, but options.sourceMap isn't set.\nIn this case the loader will discard the source map entirely for performance reasons.\nSee https://github.com/postcss/postcss-loader#sourcemap for more information.\n\n`) + if (!sourceMap && map) { + this.emitWarning(`\n\n ⚠️ PostCSS Loader\n\nPrevious source map found, but options.sourceMap is disabled.\nIn this case the loader will discard the source map entirely for performance reasons.\nSee https://github.com/postcss/postcss-loader#sourcemap for more information.\n\n`) } if (sourceMap && typeof map === 'string') map = JSON.parse(map)