Presets
If you are using 3rd party packages, follow the configuration below.
(apply configuration to react-native-esbuild.config.js)
Can't find the package in the list? Please report the package information to GitHub Issues (opens in a new tab).
@gorhom/bottom-sheet
exports.default = {
  transformer: {
    fullyTransformPackageNames: ['@gorhom/bottom-sheet'],
  },
};@react-native-community/datetimepicker
exports.default = {
  transformer: {
    stripFlowPackageNames: ['@react-native-community/datetimepicker'],
  },
};react-native-google-publisher-tag
exports.default = {
  transformer: {
    stripFlowPackageNames: ['react-native-google-publisher-tag'],
  },
};react-native-modal-datetime-picker
exports.default = {
  transformer: {
    stripFlowPackageNames: ['react-native-modal-datetime-pick'],
  },
};react-native-reanimated
exports.default = {
  transformer: {
    additionalTransformRules: {
      babel: [
        {
          test: (path, code) => {
            return (
              /node_modules\/react-native-reanimated\//.test(path) ||
              code.includes('react-native-reanimated')
            );
          },
          options: {
            plugins: ['react-native-reanimated/plugin'],
            babelrc: false,
          },
        },
      ],
    },
  },
};for Web
To build for web, follow the preset below (Reference (opens in a new tab))
exports.default = {
  transformer: {
    additionalTransformRules: {
      babel: [
        {
          test: (path, code) => {
            return (
              /node_modules\/react-native-reanimated\//.test(path) ||
              code.includes('react-native-reanimated')
            );
          },
          options: {
            plugins: [
              // add @babel/plugin-transform-export-namespace-from
              '@babel/plugin-transform-export-namespace-from',
              'react-native-reanimated/plugin',
            ],
            babelrc: false,
          },
        },
      ],
    },
  },
};react-native-scrollable-tab-view
exports.default = {
  transformer: {
    stripFlowPackageNames: ['react-native-scrollable-tab-view'],
  },
};react-native-video
exports.default = {
  transformer: {
    stripFlowPackageNames: ['react-native-video'],
  },
};rn-fetch-blob
exports.default = {
  transformer: {
    stripFlowPackageNames: ['rn-fetch-blob'],
  },
};