Skip to content

babel-config.js getConfig #851

Closed Answered by Malberee
Malberee asked this question in Q&A
May 22, 2025 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Thank you for your reply. I solved this problem by making some kind of wrapper over babel-preset and getConfig to exclude @babel/preset-react.

babel-preset.js

const bobPresetFactory = require('react-native-builder-bob/babel-preset')

module.exports = function (api, options, cwd) {
  const bobPreset = bobPresetFactory(api, options, cwd)

  return {
    ...bobPreset,
    presets: bobPreset.presets.filter(
      (preset) =>
        !(
          Array.isArray(preset) &&
          typeof preset[0] === 'string' &&
          preset[0].includes('preset-react')
        )
    ),
  }
}

babel-config.js

const {
  getConfig: originalGetConfig,
} = require('react-native-builder-bob/babel-config')

const g…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Malberee
Comment options

Answer selected by Malberee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants