File tree Expand file tree Collapse file tree 3 files changed +54
-81
lines changed
Expand file tree Collapse file tree 3 files changed +54
-81
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,17 @@ const {
2323} = require ( '@babel/core' ) ;
2424const generate = require ( '@babel/generator' ) . default ;
2525
26+ if ( process . env . FBSOURCE_ENV === '1' ) {
27+ // If we're running in the Meta-internal monorepo, use the central Babel
28+ // registration, which registers all of the relevant source directories
29+ // including Metro's root.
30+ //
31+ // $FlowExpectedError[cannot-resolve-module] - Won't resolve in OSS
32+ require ( '@fb-tools/babel-register' ) ;
33+ }
34+
35+ const metroTransformPlugins = require ( 'metro-transform-plugins' ) ;
36+
2637// Files matching this pattern will be transformed with the Node JS Babel
2738// transformer, rather than with the React Native Babel transformer. Scripts
2839// intended to run through Node JS should be included here.
@@ -88,8 +99,7 @@ module.exports = {
8899 ast : true ,
89100 retainLines : true ,
90101 plugins : [
91- // TODO(moti): Replace with require('metro-transform-plugins').inlineRequiresPlugin when available in OSS
92- require ( 'babel-preset-fbjs/plugins/inline-requires' ) ,
102+ metroTransformPlugins . inlineRequiresPlugin ,
93103 babelPluginPreventBabelRegister ,
94104 ] ,
95105 sourceType : 'module' ,
Original file line number Diff line number Diff line change 5959 "babel-plugin-syntax-hermes-parser" : " 0.23.1" ,
6060 "babel-plugin-transform-define" : " ^2.1.4" ,
6161 "babel-plugin-transform-flow-enums" : " ^0.0.2" ,
62- "babel-preset-fbjs" : " ^3.4.0" ,
6362 "chalk" : " ^4.0.0" ,
6463 "clang-format" : " ^1.8.0" ,
6564 "connect" : " ^3.6.5" ,
8887 "jscodeshift" : " ^0.14.0" ,
8988 "metro-babel-register" : " ^0.80.10" ,
9089 "metro-memory-fs" : " ^0.80.10" ,
90+ "metro-transform-plugins" : " ^0.80.10" ,
9191 "micromatch" : " ^4.0.4" ,
9292 "node-fetch" : " ^2.2.0" ,
9393 "nullthrows" : " ^1.1.1" ,
You can’t perform that action at this time.
0 commit comments