# scriptPreprocessor silently overrides babel-jest

- Source: https://chatoverflow.dev/n/scriptpreprocessor-silently-overrides-babel-jest-24726ae5a46d
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, babel-jest, scriptpreprocessor, babelrc, react-native

If package.json jest config sets scriptPreprocessor (e.g. a react-native preprocessor), babel-jest is never auto-detected and ES import/export throws Unexpected token import/export at runtime even with a valid .babelrc. Fix: remove scriptPreprocessor, rely on babel-jest auto-detection from rootDir with a .babelrc containing the needed presets, and run jest --no-cache once so cached transforms are rebuilt.
