@@ -109,7 +109,6 @@ const getModuleBuildError = memoize(() => require("./errors/ModuleBuildError"));
109109 * BuildMeta,
110110 * CodeGenerationContext,
111111 * CodeGenerationResult,
112- * CodeGenerationResultData,
113112 * ConcatenationBailoutReasonContext,
114113 * KnownBuildInfo,
115114 * LibIdentOptions,
@@ -119,7 +118,6 @@ const getModuleBuildError = memoize(() => require("./errors/ModuleBuildError"));
119118 * NeedBuildCallback,
120119 * BuildCallback,
121120 * RuntimeRequirements,
122- * Sources,
123121 * SourceType,
124122 * SourceTypes
125123 * } from "./Module"
@@ -728,11 +726,6 @@ class NormalModule extends Module {
728726 this . _sideEffectsStateGraph = undefined ;
729727 /** @type {ConnectionState | undefined } */
730728 this . _sideEffectsStateValue = undefined ;
731- /**
732- * @private
733- * @type {CodeGenerationResultData }
734- */
735- this . _codeGeneratorData = new Map ( ) ;
736729 }
737730
738731 /**
@@ -1892,10 +1885,19 @@ class NormalModule extends Module {
18921885 runtimeRequirements . add ( RuntimeGlobals . thisAsExports ) ;
18931886 }
18941887
1895- const getData = ( ) => this . _codeGeneratorData ;
1888+ /** @type {CodeGenerationResult } */
1889+ const resultEntry = {
1890+ sources : new Map ( ) ,
1891+ runtimeRequirements,
1892+ data : undefined ,
1893+ hash : undefined
1894+ } ;
1895+
1896+ const getData = ( ) => {
1897+ if ( resultEntry . data === undefined ) resultEntry . data = new Map ( ) ;
1898+ return resultEntry . data ;
1899+ } ;
18961900
1897- /** @type {Sources } */
1898- const sources = new Map ( ) ;
18991901 for ( const type of sourceTypes || chunkGraph . getModuleSourceTypes ( this ) ) {
19001902 // TODO webpack@6 make generateError required
19011903 const generator =
@@ -1930,17 +1932,10 @@ class NormalModule extends Module {
19301932 } ) ;
19311933
19321934 if ( source ) {
1933- sources . set ( type , new CachedSource ( source ) ) ;
1935+ resultEntry . sources . set ( type , new CachedSource ( source ) ) ;
19341936 }
19351937 }
19361938
1937- /** @type {CodeGenerationResult } */
1938- const resultEntry = {
1939- sources,
1940- runtimeRequirements,
1941- data : this . _codeGeneratorData ,
1942- hash : undefined
1943- } ;
19441939 return resultEntry ;
19451940 }
19461941
@@ -2116,7 +2111,6 @@ class NormalModule extends Module {
21162111 write ( this . error ) ;
21172112 write ( this . _lastSuccessfulBuildMeta ) ;
21182113 write ( this . _forceBuild ) ;
2119- write ( this . _codeGeneratorData ) ;
21202114 write ( this . hot ) ;
21212115 super . serialize ( context ) ;
21222116 }
@@ -2160,7 +2154,6 @@ class NormalModule extends Module {
21602154 this . error = read ( ) ;
21612155 this . _lastSuccessfulBuildMeta = read ( ) ;
21622156 this . _forceBuild = read ( ) ;
2163- this . _codeGeneratorData = read ( ) ;
21642157 this . hot = read ( ) ;
21652158 super . deserialize ( context ) ;
21662159 }
0 commit comments