Skip to content

Commit 762b65a

Browse files
pi0ilharp
andcommitted
fix: automatically add profile reporter when profile option enabled (#94)
Co-Authored-By: Il Harper <[email protected]>
1 parent 31e8aab commit 762b65a

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Diff for: playground/index.mjs

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
// eslint-disable-next-line unicorn/import-style
22
import "chalk";
3-
import "eslint";
4-
import "standard-version";

Diff for: playground/webpack.config.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const config = (name, color) => ({
2222
color,
2323
name,
2424
reporters: ["fancy"],
25+
profile: process.argv.includes("--profile"),
2526
// reporter: {
2627
// progress ({ state }) {
2728
// if (lastProgress !== state.progress && state.progress % 5 === 0) {

Diff for: src/index.ts

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ export default class WebpackBarPlugin extends Webpack.ProgressPlugin {
5959
return { reporter } as ReporterOpts;
6060
});
6161

62+
// Add profile if neeed
63+
if (
64+
this.options.profile &&
65+
!_reporters.some(({ reporter }) => reporter === "profile")
66+
) {
67+
_reporters.push({ reporter: "profile" });
68+
}
69+
6270
// Resolve reporters
6371
this.reporters = _reporters
6472
.map(({ reporter, options = {} }) => {

0 commit comments

Comments
 (0)