-
Notifications
You must be signed in to change notification settings - Fork 342
/
jest.resolver.js
32 lines (30 loc) · 1.11 KB
/
jest.resolver.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module.exports = (path, options) => {
// Call the defaultResolver, so we leverage its cache, error handling, etc.
return options.defaultResolver(path, {
...options,
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
packageFilter: (pkg) => {
const pkgNamesToTarget = new Set([
'@firebase/auth',
'@firebase/storage',
'@firebase/functions',
'@firebase/database',
'@firebase/auth-compat',
'@firebase/database-compat',
'@firebase/app-compat',
'@firebase/firestore',
'@firebase/firestore-compat',
'@firebase/messaging',
'@firebase/util',
'firebase',
'dexie',
])
if (pkgNamesToTarget.has(pkg.name)) {
// console.log('>>>', pkg.name)
delete pkg['exports']
delete pkg['module']
}
return pkg
},
})
}