Reviewed By: bhamodi Differential Revision: D33331422 fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
24 lines
793 B
JavaScript
24 lines
793 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
module.exports = (request, options) => {
|
|
// Call the defaultResolver, so we leverage its cache, error handling, etc.
|
|
return options.defaultResolver(request, {
|
|
...options,
|
|
// Use packageFilter to process parsed `package.json` before the resolution (see https://www.npmjs.com/package/resolve#resolveid-opts-cb)
|
|
packageFilter: (pkg) => {
|
|
return {
|
|
...pkg,
|
|
// Alter the value of `main` before resolving the package, so jest to try different entry points in the specified order.
|
|
main: pkg.flipperBundlerEntry || pkg.main,
|
|
};
|
|
},
|
|
});
|
|
};
|