Skip to content

Naming conflict with React Native's codegen plugin breaks builds when using Matter.js #3051

@Luxni

Description

@Luxni

Summary

When using Matter.js in a React Native / Expo project, builds fail with a Babel transpilation error,
because the @react-native/babel-plugin-codegen plugin treats 'Commands' as a reserved export name,
conflicting with Matter.js's Commands export in packages/node/dist/esm/endpoint/properties/Commands.js.

Error Message

  ERROR  SyntaxError: /path/to/matter/matter.js/packages/node/dist/esm/endpoint/properties/Commands.js: 'Commands' is a reserved export and may
  only be used to export the result of codegenNativeCommands.
    58 |   }[name];
    59 | }
  > 60 | export {
       | ^
    61 |   Commands
    62 | };

Related code

https://github.com/facebook/react-native/blob/4064b89867cb7424fd02433c6d597e534bfc8cbc/packages/babel-plugin-codegen/index.js#L157

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions