Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ensure compatibility with ES and CommonJS module systems for StatoscopeWebpackPlugin #358

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/webpack-why/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import StatoscopeWebpackPlugin from '@statoscope/webpack-plugin'
import _StatoscopeWebpackPlugin from '@statoscope/webpack-plugin'
import { join } from 'node:path'

function addStatoscope(limitConfig, check, webpackConfig) {
let StatoscopeWebpackPlugin = _StatoscopeWebpackPlugin.default ? _StatoscopeWebpackPlugin.default : _StatoscopeWebpackPlugin;
if (limitConfig.why) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you find a reason why it works sometime with default sometimes not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also don't know why it behaves that way. However, in my case, the module operates using the CommonJS format. Due to that error, I have to remove the --why option and configure it manually. What do you think about supporting this?

I've created a test project, and the same issue occurs. How is it in your environment?

let shouldOpen = process.env.NODE_ENV !== 'test' && !limitConfig.saveBundle

Expand Down
Loading