File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
1111const SWPrecacheWebpackPlugin = require ( 'sw-precache-webpack-plugin' ) ;
1212const paths = require ( '../config/paths' ) ;
1313const getClientEnvironment = require ( './env' ) ;
14+ const OptimizeCSSAssetsPlugin = require ( 'optimize-css-assets-webpack-plugin' ) ;
15+ const safePostCssParser = require ( 'postcss-safe-parser' ) ;
1416
1517// Webpack uses `publicPath` to determine where the app is being served from.
1618// It requires a trailing slash, or the file assets will get an incorrect path.
@@ -107,6 +109,20 @@ module.exports = {
107109 // Enable file caching
108110 cache : true ,
109111 sourceMap : shouldUseSourceMap
112+ } ) ,
113+ new OptimizeCSSAssetsPlugin ( {
114+ cssProcesorOptions : {
115+ parser : safePostCssParser ,
116+ map : shouldUseSourceMap
117+ ? {
118+ // This forces the sourcemap to be output into a separate file
119+ inline : false ,
120+ // This appends the sourceMappingURL to the end of the css file,
121+ // helping the browser find the sourcemap
122+ annotation : true
123+ }
124+ : false
125+ }
110126 } )
111127 ] ,
112128 // Automatically split vendor and commons
Original file line number Diff line number Diff line change 4444 "http-proxy-middleware" : " ^0.20.0" ,
4545 "mini-css-extract-plugin" : " ^0.4.0" ,
4646 "minimist" : " 1.2.0" ,
47+ "optimize-css-assets-webpack-plugin" : " ^5.0.3" ,
4748 "postcss-flexbugs-fixes" : " ^3.3.0" ,
4849 "postcss-loader" : " 2.1.5" ,
4950 "promise" : " 8.0.1" ,
You can’t perform that action at this time.
0 commit comments