Skip to content

Commit cb1844f

Browse files
hoo00nnhoo00nn
and
hoo00nn
authored
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 <[email protected]>
1 parent 450ae46 commit cb1844f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/webpack-why/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function addStatoscope(limitConfig, check, webpackConfig) {
66
let shouldOpen = process.env.NODE_ENV !== 'test' && !limitConfig.saveBundle
77

88
webpackConfig.plugins.push(
9-
new StatoscopeWebpackPlugin({
9+
new StatoscopeWebpackPlugin.default({
1010
additionalStats: [limitConfig.compareWith, check.compareWith].filter(
1111
Boolean
1212
),
@@ -24,7 +24,7 @@ function addStatoscope(limitConfig, check, webpackConfig) {
2424
)
2525
} else if (limitConfig.saveBundle) {
2626
webpackConfig.plugins.push(
27-
new StatoscopeWebpackPlugin({
27+
new StatoscopeWebpackPlugin.default({
2828
open: false,
2929
saveReportTo: join(limitConfig.saveBundle, 'report.html'),
3030
saveStatsTo: join(limitConfig.saveBundle, 'stats.json'),

0 commit comments

Comments
 (0)