@@ -5,6 +5,7 @@ const ReactFlightWebpackPlugin = require('react-server-dom-webpack/plugin');
5
5
// Fork End
6
6
7
7
const fs = require ( 'fs' ) ;
8
+ const { createHash} = require ( 'crypto' ) ;
8
9
const path = require ( 'path' ) ;
9
10
const webpack = require ( 'webpack' ) ;
10
11
const resolve = require ( 'resolve' ) ;
@@ -14,9 +15,7 @@ const InlineChunkHtmlPlugin = require('react-dev-utils/InlineChunkHtmlPlugin');
14
15
const TerserPlugin = require ( 'terser-webpack-plugin' ) ;
15
16
const MiniCssExtractPlugin = require ( 'mini-css-extract-plugin' ) ;
16
17
const CssMinimizerPlugin = require ( 'css-minimizer-webpack-plugin' ) ;
17
- const { WebpackManifestPlugin} = require ( 'webpack-manifest-plugin' ) ;
18
18
const InterpolateHtmlPlugin = require ( 'react-dev-utils/InterpolateHtmlPlugin' ) ;
19
- const WorkboxWebpackPlugin = require ( 'workbox-webpack-plugin' ) ;
20
19
const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' ) ;
21
20
const getCSSModuleLocalIdent = require ( 'react-dev-utils/getCSSModuleLocalIdent' ) ;
22
21
const ESLintPlugin = require ( 'eslint-webpack-plugin' ) ;
@@ -30,7 +29,12 @@ const ForkTsCheckerWebpackPlugin =
30
29
: require ( 'react-dev-utils/ForkTsCheckerWebpackPlugin' ) ;
31
30
const ReactRefreshWebpackPlugin = require ( '@pmmmwh/react-refresh-webpack-plugin' ) ;
32
31
33
- const createEnvironmentHash = require ( './webpack/persistentCache/createEnvironmentHash' ) ;
32
+ function createEnvironmentHash ( env ) {
33
+ const hash = createHash ( 'md5' ) ;
34
+ hash . update ( JSON . stringify ( env ) ) ;
35
+
36
+ return hash . digest ( 'hex' ) ;
37
+ }
34
38
35
39
// Source maps are resource heavy and can cause out of memory issue for large source files.
36
40
const shouldUseSourceMap = process . env . GENERATE_SOURCEMAP !== 'false' ;
@@ -632,30 +636,6 @@ module.exports = function (webpackEnv) {
632
636
filename : 'static/css/[name].[contenthash:8].css' ,
633
637
chunkFilename : 'static/css/[name].[contenthash:8].chunk.css' ,
634
638
} ) ,
635
- // Generate an asset manifest file with the following content:
636
- // - "files" key: Mapping of all asset filenames to their corresponding
637
- // output file so that tools can pick it up without having to parse
638
- // `index.html`
639
- // - "entrypoints" key: Array of files which are included in `index.html`,
640
- // can be used to reconstruct the HTML if necessary
641
- new WebpackManifestPlugin ( {
642
- fileName : 'asset-manifest.json' ,
643
- publicPath : paths . publicUrlOrPath ,
644
- generate : ( seed , files , entrypoints ) => {
645
- const manifestFiles = files . reduce ( ( manifest , file ) => {
646
- manifest [ file . name ] = file . path ;
647
- return manifest ;
648
- } , seed ) ;
649
- const entrypointFiles = entrypoints . main . filter (
650
- fileName => ! fileName . endsWith ( '.map' )
651
- ) ;
652
-
653
- return {
654
- files : manifestFiles ,
655
- entrypoints : entrypointFiles ,
656
- } ;
657
- } ,
658
- } ) ,
659
639
// Moment.js is an extremely popular library that bundles large locale files
660
640
// by default due to how webpack interprets its code. This is a practical
661
641
// solution that requires the user to opt into importing specific locales.
@@ -665,19 +645,6 @@ module.exports = function (webpackEnv) {
665
645
resourceRegExp : / ^ \. \/ l o c a l e $ / ,
666
646
contextRegExp : / m o m e n t $ / ,
667
647
} ) ,
668
- // Generate a service worker script that will precache, and keep up to date,
669
- // the HTML & assets that are part of the webpack build.
670
- isEnvProduction &&
671
- fs . existsSync ( swSrc ) &&
672
- new WorkboxWebpackPlugin . InjectManifest ( {
673
- swSrc,
674
- dontCacheBustURLsMatching : / \. [ 0 - 9 a - f ] { 8 } \. / ,
675
- exclude : [ / \. m a p $ / , / a s s e t - m a n i f e s t \. j s o n $ / , / L I C E N S E / ] ,
676
- // Bump up the default maximum size (2mb) that's precached,
677
- // to make lazy-loading failure scenarios less likely.
678
- // See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270
679
- maximumFileSizeToCacheInBytes : 5 * 1024 * 1024 ,
680
- } ) ,
681
648
// TypeScript type checking
682
649
useTypeScript &&
683
650
new ForkTsCheckerWebpackPlugin ( {
0 commit comments