2 * Jest seems to never resolve the 'import' condition from the package.json `exports`,
3 * and instead it only looks for e.g. ['node', 'require', 'default', 'browser'].
4 * Since we rely on babel to transform ESM file, we can force the resolver to also consider
5 * the 'import' field, if the default resolution method fails.
6 * However, this means that the CJS conditions always have priority in the module resolution,
7 * which might cause unexpected issues in some packages (but not in the ones we currently use).
9 module.exports = function (request, options) {
11 return options.defaultResolver(request, options);
13 if (options.conditions) {
14 return options.defaultResolver(request, { ...options, conditions: ['import'] });