-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtranspilePackages.js
More file actions
22 lines (19 loc) · 967 Bytes
/
transpilePackages.js
File metadata and controls
22 lines (19 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module.exports = {
commonPackages: ['@codegouvfr/react-dsfr', '@mui/x-data-grid', '@mui/x-date-pickers', 'tss-react'],
additionalJestPackages: [],
formatTransformIgnorePatterns(packagesToTranspile, previousPatterns) {
// Inspired from `next.js/packages/next/src/build/jest/jest.ts`
const transpiled = (packagesToTranspile ?? []).join('|');
return [
// To match Next.js behavior node_modules is not transformed, only `transpiledPackages`
...(transpiled
? [`/node_modules/(?!.pnpm)(?!(${transpiled})/)`, `/node_modules/.pnpm/(?!(${transpiled.replace(/\//g, '\\+')})@)`]
: ['/node_modules/']),
// CSS modules are mocked so they don't need to be transformed
'^.+\\.module\\.(css|sass|scss)$',
// Custom config can append to transformIgnorePatterns but not modify it
// This is to ensure `node_modules` and .module.css/sass/scss are always excluded
...(previousPatterns || []),
];
},
};