cache HarmonyExportImportedDependency.getMode

This commit is contained in:
Tobias Koppers 2021-04-13 19:06:23 +02:00
parent bbcc5a8ebe
commit 0513a52df6
1 changed files with 10 additions and 0 deletions

View File

@ -178,6 +178,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
this.otherStarExports = otherStarExports;
this.strictExportPresence = strictExportPresence;
this.allStarExports = allStarExports;
this._getMode = this._getMode.bind(this);
}
// TODO webpack 6 remove
@ -222,6 +223,15 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
* @returns {ExportMode} the export mode
*/
getMode(moduleGraph, runtime) {
return moduleGraph.cached(this._getMode, runtime);
}
/**
* @param {ModuleGraph} moduleGraph the module graph
* @param {RuntimeSpec} runtime the runtime
* @returns {ExportMode} the export mode
*/
_getMode(moduleGraph, runtime) {
const name = this.name;
const ids = this.getIds(moduleGraph);
const parentModule = moduleGraph.getParentModule(this);