react icon indicating copy to clipboard operation
react copied to clipboard

Catch ESM-only modules before publishing

Open joshblack opened this issue 3 years ago • 0 comments

This issue tracks our testing strategy in order to make sure that packages which we depend on ship support for both ESM and CommonJS.

After looking at the project initially, it seems like reverting the changes to this field will give us a strong signal: https://github.com/primer/react/blob/main/jest.config.js#L13

Specifically, this field should only include '/node_modules/'. Excluding other packages from this list is a good signal that this package ships an ESM-only package.

Limitations

The limitation of relying on this field to catch this problem is that if a code path is not tested through Jest then it will not be caught since we rely on Jest to throw an error when CommonJS is not supported from a package in node_modules

joshblack avatar Aug 25 '22 18:08 joshblack