Update selected item color in Pass menu
[ProtonMail-WebClient.git] / packages / components / jest.resolver.js
blob34f2664b15d4989ee072c8b7867b91ee4f8f045f
1 /**
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).
8 */
9 module.exports = function (request, options) {
10 try {
11 return options.defaultResolver(request, options);
12 } catch (err) {
13 if (options.conditions) {
14 return options.defaultResolver(request, { ...options, conditions: ['import'] });