MCPcopy
hub / github.com/webpack/webpack / build

Method build

lib/NormalModule.js:1769–1982  ·  lib/NormalModule.js::NormalModule.build

* Builds the module using the provided compilation context. * @param {WebpackOptions} options webpack options * @param {Compilation} compilation the compilation * @param {ResolverWithOptions} resolver the resolver * @param {InputFileSystem} fs the file system * @param {BuildCallback} callb

(options, compilation, resolver, fs, callback)

Source from the content-addressed store, hash-verified

1767 * @returns {void}
1768 */
1769 build(options, compilation, resolver, fs, callback) {
1770 this._forceBuild = false;
1771 this._source = null;
1772 if (this._sourceSizes !== undefined) this._sourceSizes.clear();
1773 this._sourceTypes = undefined;
1774 this._ast = null;
1775 this.error = null;
1776 this.clearWarningsAndErrors();
1777 this.clearDependenciesAndBlocks();
1778 this.buildMeta = {
1779 exportsType: undefined,
1780 defaultObject: undefined,
1781 strictHarmonyModule: undefined,
1782 async: undefined
1783 };
1784 this.buildInfo = {
1785 cacheable: false,
1786 parsed: true,
1787 fileDependencies: undefined,
1788 contextDependencies: undefined,
1789 missingDependencies: undefined,
1790 buildDependencies: undefined,
1791 valueDependencies: undefined,
1792 hash: undefined,
1793 assets: undefined,
1794 assetsInfo: undefined,
1795 snapshot: undefined,
1796 strict: undefined,
1797 exportsArgument: undefined,
1798 moduleArgument: undefined,
1799 topLevelDeclarations: undefined,
1800 pureFunctions: undefined,
1801 inlineExports: undefined,
1802 moduleConcatenationBailout: undefined,
1803 needCreateRequire: undefined
1804 };
1805
1806 const startTime = compilation.compiler.fsStartTime || Date.now();
1807
1808 const hooks = NormalModule.getCompilationHooks(compilation);
1809
1810 return this._doBuild(options, compilation, resolver, fs, hooks, (err) => {
1811 class="cm">// if we have an error mark module as failed and exit
1812 if (err) {
1813 this.markModuleAsErrored(err);
1814 this._initBuildHash(compilation);
1815 return callback();
1816 }
1817
1818 /**
1819 * @param {Error} e error
1820 * @returns {void}
1821 */
1822 const handleParseError = (e) => {
1823 const source = /** @type {Source} */ (this._source).source();
1824 const loaders = this.loaders.map((item) =>
1825 contextify(options.context, item.loader, compilation.compiler.root)
1826 );

Callers

nothing calls this directly

Calls 12

_doBuildMethod · 0.95
markModuleAsErroredMethod · 0.95
_initBuildHashMethod · 0.95
shouldPreventParsingMethod · 0.95
sourceMethod · 0.80
callbackFunction · 0.50
clearMethod · 0.45
getCompilationHooksMethod · 0.45
callMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected