@@ -17,7 +17,7 @@ const PnpWebpackPlugin = require('pnp-webpack-plugin');
1717const CaseSensitivePathsPlugin = require ( 'case-sensitive-paths-webpack-plugin' ) ;
1818// const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
1919// const TerserPlugin = require('terser-webpack-plugin');
20- const MiniCssExtractPlugin = require ( 'mini-css-extract-plugin' ) ;
20+ // const MiniCssExtractPlugin = require('mini-css-extract-plugin');
2121// const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
2222// const safePostCssParser = require('postcss-safe-parser');
2323// const ManifestPlugin = require('webpack-manifest-plugin');
@@ -59,6 +59,7 @@ const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';
5959// We might not want to use the hard source plugin on environments that won't persist the cache for later
6060const useHardSourceWebpackPlugin =
6161 process . env . USE_HARD_SOURCE_WEBPACK_PLUGIN === 'true' ;
62+ const environmentHash = require ( './environmentHash' ) ;
6263
6364// Check if TypeScript is setup
6465const useTypeScript = fs . existsSync ( paths . appTsConfig ) ;
@@ -87,7 +88,7 @@ module.exports = function(webpackEnv) {
8788 : isEnvDevelopment && '/' ;
8889 // Some apps do not use client-side routing with pushState.
8990 // For these, "homepage" can be set to "." to enable relative asset paths.
90- const shouldUseRelativeAssetPaths = publicPath === './' ;
91+ // const shouldUseRelativeAssetPaths = publicPath === './';
9192
9293 // `publicUrl` is just like `publicPath`, but we will provide it to our app
9394 // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
@@ -616,7 +617,8 @@ module.exports = function(webpackEnv) {
616617 } ,
617618 plugins : [
618619 new webpack . IgnorePlugin ( / \/ i c o n v - l o a d e r $ / ) , // https://github.com/webpack/webpack/issues/3078#issuecomment-400697407
619- useHardSourceWebpackPlugin && new HardSourceWebpackPlugin ( ) ,
620+ useHardSourceWebpackPlugin &&
621+ new HardSourceWebpackPlugin ( { environmentHash } ) ,
620622 useHardSourceWebpackPlugin &&
621623 new HardSourceWebpackPlugin . ExcludeModulePlugin ( [
622624 {
@@ -675,7 +677,10 @@ module.exports = function(webpackEnv) {
675677 // It is absolutely essential that NODE_ENV is set to production
676678 // during a production build.
677679 // Otherwise React will be compiled in the very slow development mode.
678- new webpack . DefinePlugin ( env . stringified ) ,
680+ new webpack . DefinePlugin ( {
681+ ...env . stringified ,
682+ 'typeof window' : '"undefined"' ,
683+ } ) ,
679684 // This is necessary to emit hot updates (currently CSS only):
680685 // isEnvDevelopment && new webpack.HotModuleReplacementPlugin(),
681686 // Watcher doesn't work well if you mistype casing in a path so we use
0 commit comments