ai / size-limit

Calculate the real cost to run your JS app or lib to keep good performance. Show error in pull request if the cost exceeds the limit.
MIT License
6.48k stars 1.82k forks source link

Fix StatoscopeWebpackPlugin import to support default export #357

Closed hoo00nn closed 4 months ago

hoo00nn commented 4 months ago

An error TypeError: StatoscopeWebpackPlugin is not a constructor occurs if the module does not export as default.

@ai Hello, I wanted to bring to your attention an issue I've found while utilizing the @size-limit/webpack-why package. Since I got an error message (StatoscopeWebpackPlugin is not a constructor), I have consulted with the official documentation. They advised that the class should be imported using the default export.

I have submitted a PR addressing this matter and would greatly appreciate it if you could take a moment to review the proposed changes. Your feedback would be invaluable.

ai commented 4 months ago

Strange that we do not catch it with tests

ai commented 4 months ago

Now we have a broken CI since we tested it https://github.com/ai/size-limit/actions/runs/8250644947/job/22565763246

Something strange happens. Can you investigate and send another PR (I will revert this one)?

hoo00nn commented 4 months ago

Now we have a broken CI since we tested it https://github.com/ai/size-limit/actions/runs/8250644947/job/22565763246 Something strange happens. Can you investigate and send another PR (I will revert this one)?

@ai Yes, I'll check.

hoo00nn commented 4 months ago

@ai, Hello

After further investigation, I was unable to pinpoint the exact cause of the issue. However, I've observed that depending on the project, the module in question may operate in either ES or CommonJS mode. To prevent any issues between the two module systems, I've made the necessary code fix and submitted the PR. I would appreciate your feedback on this.

all tests are passing.