forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.build.js
34 lines (31 loc) · 1.15 KB
/
config.build.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
33
34
'use strict';
const {readdirSync, statSync} = require('fs');
const {join} = require('path');
const baseConfig = require('./config.base');
// Find all folders in packages/* with package.json
const packagesRoot = join(__dirname, '..', '..', 'packages');
const packages = readdirSync(packagesRoot).filter(dir => {
if (dir.charAt(0) === '.') {
return false;
}
const packagePath = join(packagesRoot, dir, 'package.json');
return statSync(packagePath).isFile();
});
// Create a module map to point React packages to the build output
const moduleNameMapper = {};
packages.forEach(name => {
// Root entry point
moduleNameMapper[`^${name}$`] = `<rootDir>/build/node_modules/${name}`;
// Named entry points
moduleNameMapper[
`^${name}/(.*)$`
] = `<rootDir>/build/node_modules/${name}/$1`;
});
module.exports = Object.assign({}, baseConfig, {
// Redirect imports to the compiled bundles
moduleNameMapper,
// Don't run bundle tests on blacklisted -test.internal.* files
testPathIgnorePatterns: ['/node_modules/', '-test.internal.js$'],
// Exclude the build output from transforms
transformIgnorePatterns: ['/node_modules/', '<rootDir>/build/'],
});