MCPcopy
hub / github.com/webpack/webpack / createSimpleCompilerWithCustomHandler

Function createSimpleCompilerWithCustomHandler

test/ProgressPlugin.test.js:64–83  ·  view source on GitHub ↗
(
	/** @type {Record<string, unknown> | undefined} */ options = undefined
)

Source from the content-addressed store, hash-verified

62};
63
64const createSimpleCompilerWithCustomHandler = (
65 /** @type {Record<string, unknown> | undefined} */ options = undefined
66) => {
67 const compiler = webpack({
68 context: path.join(__dirname, "fixtures"),
69 entry: "./a.js"
70 });
71
72 compiler.outputFileSystem = /** @type {import("../").OutputFileSystem} */ (
73 /** @type {unknown} */ (createFsFromVolume(new Volume()))
74 );
75 const logger = compiler.getInfrastructureLogger("custom test logger");
76 new webpack.ProgressPlugin({
77 activeModules: true,
78 ...options,
79 handler: (...args) => logger.status(args)
80 }).apply(compiler);
81
82 return compiler;
83};
84
85const getLogs = (/** @type {string} */ logsStr) =>
86 logsStr.split(/\r/).filter((/** @type {string} */ v) => v !== " ");

Callers 1

Calls 4

applyMethod · 0.65
statusMethod · 0.65
webpackFunction · 0.50

Tested by

no test coverage detected