Skip to content

Commit

Permalink
bugfix dev plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
veronikaa-kuznetsova committed May 28, 2024
1 parent c34bdc2 commit 55821a4
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions config/build/buildPlugins.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import HTMLWebpackPlugin from 'html-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import webpack from 'webpack';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
import { BuildOptions } from './types/config';

export function buildPlugins({ paths, isDev }: BuildOptions): webpack.WebpackPluginInstance[] {
return [
new HTMLWebpackPlugin({
const plugins = [
new HtmlWebpackPlugin({
template: paths.html,
}),
new webpack.ProgressPlugin(),
Expand All @@ -17,9 +17,14 @@ export function buildPlugins({ paths, isDev }: BuildOptions): webpack.WebpackPlu
new webpack.DefinePlugin({
__IS_DEV__: JSON.stringify(isDev),
}),
new webpack.HotModuleReplacementPlugin(),
new BundleAnalyzerPlugin({
openAnalyzer: false,
}),
];

if (isDev) {
plugins.push(new webpack.HotModuleReplacementPlugin());
plugins.push(new BundleAnalyzerPlugin({
openAnalyzer: false,
}));
}

return plugins;
}

0 comments on commit 55821a4

Please sign in to comment.