From a2b5e8c9664f1be6325801aca52bcf0a4c1ecb4c Mon Sep 17 00:00:00 2001 From: Jaehyoung Kim Date: Tue, 2 Oct 2018 23:17:48 +0900 Subject: [PATCH] Fix GENERATE_SOURCEMAP env not working for css sourcemap --- .../config/webpack.config.prod.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index b1db45d778e..ef4bc311d58 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -171,14 +171,16 @@ module.exports = { new OptimizeCSSAssetsPlugin({ cssProcessorOptions: { parser: safePostCssParser, - map: { - // `inline: false` forces the sourcemap to be output into a - // separate file - inline: false, - // `annotation: true` appends the sourceMappingURL to the end of - // the css file, helping the browser find the sourcemap - annotation: true, - }, + map: shouldUseSourceMap + ? { + // `inline: false` forces the sourcemap to be output into a + // separate file + inline: false, + // `annotation: true` appends the sourceMappingURL to the end of + // the css file, helping the browser find the sourcemap + annotation: true, + } + : false, }, }), ],