MCPcopy
hub / github.com/webpack/webpack / compile

Function compile

test/PersistentCaching.test.js:76–103  ·  test/PersistentCaching.test.js::compile
(/** @type {EXPECTED_ANY} */ configAdditions = {})

Source from the content-addressed store, hash-verified

74 };
75
76 const compile = async (/** @type {EXPECTED_ANY} */ configAdditions = {}) =>
77 new Promise((resolve, reject) => {
78 const webpack = require(class="st">"../");
79
80 webpack(
81 /** @type {import(class="st">"../").Configuration} */ (
82 /** @type {unknown} */ ({
83 ...config,
84 ...configAdditions,
85 cache: {
86 ...config.cache,
87 .../** @type {EXPECTED_ANY} */ (configAdditions).cache
88 }
89 })
90 ),
91 (
92 /** @type {Error | null} */ err,
93 /** @type {import(class="st">"../").Stats | undefined} */ _stats
94 ) => {
95 if (err) return reject(err);
96 const stats = /** @type {import(class="st">"../").Stats} */ (_stats);
97 if (stats.hasErrors()) {
98 return reject(stats.toString({ preset: class="st">"errors-only" }));
99 }
100 resolve(stats);
101 }
102 );
103 });
104
105 const getCacheFileTimes = async () => {
106 const cacheFiles = (await readdir(cachePath)).sort();

Callers 2

cFunction · 0.70

Calls 5

resolveFunction · 0.85
requireFunction · 0.70
webpackFunction · 0.50
hasErrorsMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected