Bugfix: Add missing .cjs extension to babel loader test in the webpack config #12578
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.
This PR adds the missed .cjs extension to the webpack config loader section. According to webpack docs found here to force the module type of a file you can use the .cjs extension similarly to .mjs for ESM. Without this extension explicitly added to the loader test rule, packages using .cjs file as a
main
in there package.json will not work at all. The index.cjs file is picked up by the file loader and treated as an asset. A good example of this behavior are all prosemirror packages witch are not usable in CRA app.I tested my changes on a the codebase of a relatively complex project I am working on and the change is not breaking anything so far. Sorry but I cannot share screens from this project :)