Skip to content

Commit 7c9c5ff

Browse files
committed
move plugins from constructor to build-config
1 parent fda837c commit 7c9c5ff

File tree

1 file changed

+23
-28
lines changed

1 file changed

+23
-28
lines changed

src/Kaba.ts

+23-28
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export class Kaba
4848
private publicPath: string = "/assets/app/js/";
4949
private externals: Externals = {};
5050
private moduleConcatenationEnabled: boolean = false;
51-
private plugins: webpack.Plugin[] = [];
5251
private javaScriptDependenciesFileName: string = "_dependencies";
5352
private hashFileNames: boolean = true;
5453
private buildModern: boolean = true;
@@ -62,23 +61,6 @@ export class Kaba
6261
{
6362
this.cwd = process.cwd();
6463
this.libRoot = path.dirname(__dirname);
65-
this.plugins = [
66-
new ProgressBarPlugin({
67-
complete: green("─"),
68-
incomplete: gray("─"),
69-
width: 50,
70-
format: ` ${cyan("build")} :bar ${green(":percent")} ${gray(":msg")} `,
71-
}),
72-
new DuplicatePackageCheckerPlugin({
73-
emitError: true,
74-
strict: true,
75-
}),
76-
new ProvidePlugin({
77-
h: ["preact", "h"],
78-
Fragment: ["preact", "Fragment"],
79-
}),
80-
new CleanWebpackPlugin(),
81-
];
8264

8365
// set defaults
8466
this.setOutputPath("build");
@@ -435,7 +417,29 @@ export class Kaba
435417
},
436418

437419
// plugins
438-
plugins: this.plugins,
420+
plugins: [
421+
new ProgressBarPlugin({
422+
complete: green("─"),
423+
incomplete: gray("─"),
424+
width: 50,
425+
format: ` ${cyan("build")} :bar ${green(":percent")} ${gray(":msg")} `,
426+
}),
427+
new DuplicatePackageCheckerPlugin({
428+
emitError: true,
429+
strict: true,
430+
}),
431+
new ProvidePlugin({
432+
h: ["preact", "h"],
433+
Fragment: ["preact", "Fragment"],
434+
}),
435+
new CleanWebpackPlugin(),
436+
new DefinePlugin({
437+
'process.env.MODERN_BUILD': isModule,
438+
'MODERN_BUILD': isModule,
439+
'process.env.DEBUG': cliConfig.debug,
440+
'DEBUG': cliConfig.debug,
441+
}),
442+
],
439443

440444
// watch
441445
watch: cliConfig.watch,
@@ -446,15 +450,6 @@ export class Kaba
446450
node: this.nodeSettings,
447451
} as Partial<webpack.Configuration>;
448452

449-
(configTemplate.plugins as webpack.Plugin[]).push(
450-
new DefinePlugin({
451-
'process.env.MODERN_BUILD': isModule,
452-
'MODERN_BUILD': isModule,
453-
'process.env.DEBUG': cliConfig.debug,
454-
'DEBUG': cliConfig.debug,
455-
})
456-
);
457-
458453
if (!cliConfig.debug)
459454
{
460455
(configTemplate.optimization as any).minimizer.push(new TerserPlugin({

0 commit comments

Comments
 (0)