* Assuming this module is in the cache. Remove internal references to allow freeing some memory.
()
| 1024 | * Assuming this module is in the cache. Remove internal references to allow freeing some memory. |
| 1025 | */ |
| 1026 | cleanupForCache() { |
| 1027 | // Make sure to cache types and sizes before cleanup when this module has been built |
| 1028 | // They are accessed by the stats and we don't want them to crash after cleanup |
| 1029 | // TODO reconsider this for webpack 6 |
| 1030 | if (this.buildInfo) { |
| 1031 | if (this._sourceTypes === undefined) this.getSourceTypes(); |
| 1032 | for (const type of /** @type {SourceTypes} */ (this._sourceTypes)) { |
| 1033 | this.size(type); |
| 1034 | } |
| 1035 | } |
| 1036 | super.cleanupForCache(); |
| 1037 | this.parser = undefined; |
| 1038 | this.parserOptions = undefined; |
| 1039 | this.generator = undefined; |
| 1040 | this.generatorOptions = undefined; |
| 1041 | // Drop the side-effects memoization so a long-lived module doesn't |
| 1042 | // strong-reference a stale `ModuleGraph`/`Compilation` for graphs |
| 1043 | // that never get re-queried with a fresh one. |
| 1044 | this._sideEffectsStateGraph = undefined; |
| 1045 | this._sideEffectsStateValue = undefined; |
| 1046 | } |
| 1047 | |
| 1048 | /** |
| 1049 | * Module should be unsafe cached. Get data that's needed for that. |
nothing calls this directly
no test coverage detected