Skip to content

Export namespace should be first transformed by @babel/plugin-proposal-export-namespace-from on export * as default from './Animated'; #3410

Closed
@tomekzaw

Description

@tomekzaw

Description

Starting from Reanimated 2.9.0, if you forget to add Reanimated's Babel plugin, instead of a user-friendly error message, the following error will appear:

error: node_modules/react-native-reanimated/src/index.ts: /Users/tomekzaw/RNOS/Issue3397/node_modules/react-native-reanimated/src/index.ts: Export namespace should be first transformed by `@babel/plugin-proposal-export-namespace-from`.
  5 | export * from './reanimated1';
  6 | export * from './reanimated2';
> 7 | export * as default from './Animated';
    |        ^^^^^^^^^^^^
  8 |
Android iOS
iOS error Android error

funny meme

Solution

  1. Add Reanimated's babel plugin to your babel.config.js:
module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
+  plugins: ['react-native-reanimated/plugin'],
};
  1. Clear application cache (depending on your workflow or favourite package manager):
  • yarn start --reset-cache
  • OR: npm start -- --reset-cache
  • OR: expo start -c
  1. Reload app

See installation docs for more details.

Disclaimer

Obviously, we need to restore the original user-friendly error message:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions