From cb1844f5d602c3576149bb68f01d0054f3452cf6 Mon Sep 17 00:00:00 2001 From: Jihun Oh Date: Tue, 12 Mar 2024 23:31:43 +0900 Subject: [PATCH] Fix StatoscopeWebpackPlugin import to support default export (#357) The import of StatoscopeWebpackPlugin was adjusted to use the default export, which is necessary when the module exports a single class or function as the default. This change ensures that the plugin is correctly instantiated whether the `why` flag is used or not, and it resolves issues that may arise if the module is not exporting an object with named exports. The `new StatoscopeWebpackPlugin` calls have been replaced with `new StatoscopeWebpackPlugin.default` to reflect this change. Co-authored-by: hoo00nn --- packages/webpack-why/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/webpack-why/index.js b/packages/webpack-why/index.js index 05eefb93..2c982967 100644 --- a/packages/webpack-why/index.js +++ b/packages/webpack-why/index.js @@ -6,7 +6,7 @@ function addStatoscope(limitConfig, check, webpackConfig) { let shouldOpen = process.env.NODE_ENV !== 'test' && !limitConfig.saveBundle webpackConfig.plugins.push( - new StatoscopeWebpackPlugin({ + new StatoscopeWebpackPlugin.default({ additionalStats: [limitConfig.compareWith, check.compareWith].filter( Boolean ), @@ -24,7 +24,7 @@ function addStatoscope(limitConfig, check, webpackConfig) { ) } else if (limitConfig.saveBundle) { webpackConfig.plugins.push( - new StatoscopeWebpackPlugin({ + new StatoscopeWebpackPlugin.default({ open: false, saveReportTo: join(limitConfig.saveBundle, 'report.html'), saveStatsTo: join(limitConfig.saveBundle, 'stats.json'),