Skip to content

Instantly share code, notes, and snippets.

@usrbowe
Last active September 26, 2022 14:39
Show Gist options
  • Save usrbowe/cf0fe2bf4e73923059d06bb442d054f9 to your computer and use it in GitHub Desktop.
Save usrbowe/cf0fe2bf4e73923059d06bb442d054f9 to your computer and use it in GitHub Desktop.
React Native Profiler <= RN 0.59
// React Native version <= 0.59
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
["module-resolver", {
"root": ["./"],
"alias": {
"ReactNativeRenderer-prod": "./node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-profiling",
"scheduler/tracing": "scheduler/tracing-profiling"
}
}]
]
}
// React Native version >= 0.60
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
["module-resolver", {
"root": ["./"],
"alias": {
"ReactNativeRenderer-prod": "./node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling",
"scheduler/tracing": "scheduler/tracing-profiling"
}
}]
]
}
@louiszawadzki
Copy link

louiszawadzki commented Sep 26, 2022

For react native version >= 0.61, you can use this in your babel.config.js:

const path = require('path');

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    [
      'module-resolver',
      {
        root: ['./'],
        resolvePath(sourcePath) {
          if (sourcePath === '../implementations/ReactNativeRenderer-prod') {
            return path.resolve(
              __dirname,
              './node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-profiling',
            );
          }
          return undefined;
        },
      },
    ],
  ],
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment