mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
be469c1b86
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39079 Changelog: [Internal] The Babel config for Node packages in the RN repo, added in D47760330 / D48312463, relies on [name normalization](https://babeljs.io/docs/options#name-normalization) to resolve the Babel presets and plugins that it references. This works for OSS but can cause other integrations to fail to resolve the packages, depending on the details of how they're installed. Here we eagerly resolve the packages when constructing the Babel config. Reviewed By: huntie Differential Revision: D48469386 fbshipit-source-id: d9c15883169e30984d93fc6a5d9544752db5d2c8
45 lines
914 B
JavaScript
45 lines
914 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.
|
|
*
|
|
* @flow
|
|
* @format
|
|
* @oncall react_native
|
|
*/
|
|
|
|
/*::
|
|
import type {BabelCoreOptions} from '@babel/core';
|
|
*/
|
|
|
|
const TARGET_NODE_VERSION = '18';
|
|
|
|
const config /*: BabelCoreOptions */ = {
|
|
presets: [
|
|
require.resolve('@babel/preset-flow'),
|
|
[
|
|
require.resolve('@babel/preset-env'),
|
|
{
|
|
targets: {
|
|
node: TARGET_NODE_VERSION,
|
|
},
|
|
},
|
|
],
|
|
],
|
|
plugins: [
|
|
[
|
|
require.resolve('babel-plugin-transform-define'),
|
|
{
|
|
'process.env.BUILD_EXCLUDE_BABEL_REGISTER': true,
|
|
},
|
|
],
|
|
[
|
|
require.resolve('babel-plugin-minify-dead-code-elimination'),
|
|
{keepFnName: true, keepFnArgs: true, keepClassName: true},
|
|
],
|
|
],
|
|
};
|
|
|
|
module.exports = config;
|