* Builds the module object * @param {Module} module module to be built * @param {ModuleCallback} callback the callback * @returns {void}
(module, callback)
| 1691 | * @returns {void} |
| 1692 | */ |
| 1693 | _buildModule(module, callback) { |
| 1694 | const currentProfile = this.profile |
| 1695 | ? this.moduleGraph.getProfile(module) |
| 1696 | : undefined; |
| 1697 | if (currentProfile !== undefined) { |
| 1698 | currentProfile.markBuildingStart(); |
| 1699 | } |
| 1700 | |
| 1701 | module.needBuild( |
| 1702 | { |
| 1703 | compilation: this, |
| 1704 | fileSystemInfo: this.fileSystemInfo, |
| 1705 | valueCacheVersions: this.valueCacheVersions |
| 1706 | }, |
| 1707 | (err, needBuild) => { |
| 1708 | if (err) return callback(err); |
| 1709 | |
| 1710 | if (!needBuild) { |
| 1711 | if (currentProfile !== undefined) { |
| 1712 | currentProfile.markBuildingEnd(); |
| 1713 | } |
| 1714 | this.hooks.stillValidModule.call(module); |
| 1715 | return callback(); |
| 1716 | } |
| 1717 | |
| 1718 | this.hooks.buildModule.call(module); |
| 1719 | this.builtModules.add(module); |
| 1720 | module.build( |
| 1721 | this.options, |
| 1722 | this, |
| 1723 | this.resolverFactory.get("normal", module.resolveOptions), |
| 1724 | /** @type {InputFileSystem} */ |
| 1725 | (this.inputFileSystem), |
| 1726 | (err) => { |
| 1727 | if (currentProfile !== undefined) { |
| 1728 | currentProfile.markBuildingEnd(); |
| 1729 | } |
| 1730 | if (err) { |
| 1731 | this.hooks.failedModule.call(module, err); |
| 1732 | return callback(err); |
| 1733 | } |
| 1734 | if (currentProfile !== undefined) { |
| 1735 | currentProfile.markStoringStart(); |
| 1736 | } |
| 1737 | this._modulesCache.store( |
| 1738 | module.identifier(), |
| 1739 | null, |
| 1740 | module, |
| 1741 | (err) => { |
| 1742 | if (currentProfile !== undefined) { |
| 1743 | currentProfile.markStoringEnd(); |
| 1744 | } |
| 1745 | if (err) { |
| 1746 | this.hooks.failedModule.call( |
| 1747 | module, |
| 1748 | /** @type {WebpackError} */ (err) |
| 1749 | ); |
| 1750 | return callback(new ModuleStoreError(module, err)); |
nothing calls this directly
no test coverage detected