From 367f1808fb6f30ebbab7d7541bdcf60ab9017fee Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 4 May 2018 17:12:35 -0400 Subject: [PATCH 1/3] fix(index): do not emit sourceMap warning when explicitly set to false --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 5afceeef..15c6d597 100644 --- a/lib/index.js +++ b/lib/index.js @@ -137,7 +137,7 @@ module.exports = function loader (css, map, meta) { css = this.exec(css, this.resource) } - if (!sourceMap && map) { + if (!sourceMap && sourceMap !== false && 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 ee8762870dcf7cbc1f5934656c336fc782fa8ccb Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 4 May 2018 19:07:54 -0400 Subject: [PATCH 2/3] Update index.js --- lib/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/index.js b/lib/index.js index 15c6d597..6db1dca1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -137,10 +137,6 @@ module.exports = function loader (css, map, meta) { css = this.exec(css, this.resource) } - if (!sourceMap && sourceMap !== false && 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 && typeof map === 'string') map = JSON.parse(map) if (sourceMap && map) options.map.prev = map From 2bb855c025b1817392af8253dfe62f6ed32f8b39 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 4 May 2018 19:08:45 -0400 Subject: [PATCH 3/3] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index f331fc7a..a3465703 100644 --- a/README.md +++ b/README.md @@ -268,8 +268,6 @@ module.exports = ({ file, options, env }) => ({ Enables source map support, `postcss-loader` will use the previous source map given by other loaders and update it accordingly, if no previous loader is applied before `postcss-loader`, the loader will generate a source map for you. -> :warning: If a previous loader like e.g `sass-loader` is applied and it's `sourceMap` option is set, but the `sourceMap` option in `postcss-loader` is omitted, previous source maps will be discarded by `postcss-loader` **entirely**. - **webpack.config.js** ```js {