fix(@size-limit/webpack-css v10.0.1 ): require is not defined in ES module scope when running size-limit #340
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Good day! Thank you very much for this amazing tool!
Problem
In our project we are using
size-limit
with@size-limit/webpack-css
plugin and with latest versionv10.0.1
we are having an issue and see this error runningsize-limit
.The whole error
Version
size-limit: v10.0.1
node: v18.8.0.
To reproduce
Here is a repo example with reproduction: https://github.com/mendrew/stunning-journey
Proposal
As a solution we use
createRequire
to require commonjs from esm module like we do here insize-limit
in other modules. Works well in my case. Hope it close to a solution.Changes
Notes
Unfortunately I was not able to reproduce this issue in tests. Any ideas where I can put a test which would be similar to the example with reproduction?
load-plugins.test.js
doesn't catch this issue.