diff --git a/playground/index.mjs b/playground/index.mjs index f635ab3..ce216e8 100644 --- a/playground/index.mjs +++ b/playground/index.mjs @@ -1,4 +1,2 @@ // eslint-disable-next-line unicorn/import-style import "chalk"; -import "eslint"; -import "standard-version"; diff --git a/playground/webpack.config.cjs b/playground/webpack.config.cjs index c277e8a..5be8bf3 100644 --- a/playground/webpack.config.cjs +++ b/playground/webpack.config.cjs @@ -22,6 +22,7 @@ const config = (name, color) => ({ color, name, reporters: ["fancy"], + profile: process.argv.includes("--profile"), // reporter: { // progress ({ state }) { // if (lastProgress !== state.progress && state.progress % 5 === 0) { diff --git a/src/index.ts b/src/index.ts index bb9fc3e..86dcfcf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -59,6 +59,14 @@ export default class WebpackBarPlugin extends Webpack.ProgressPlugin { return { reporter } as ReporterOpts; }); + // Add profile if neeed + if ( + this.options.profile && + !_reporters.some(({ reporter }) => reporter === "profile") + ) { + _reporters.push({ reporter: "profile" }); + } + // Resolve reporters this.reporters = _reporters .map(({ reporter, options = {} }) => {