Skip to content

💡 Enable metro plugin when expo is installed #1565

@DaniFoldi

Description

@DaniFoldi

Suggest an idea for Knip

Hi 👋,

Expo is a complicated framework, because (unlike others, eg. next or astro which rely on build tools and wrap their configuration) it uses babel/metro config files. Expo depends on @expo/metro, which depends on all the metro tools, but that's not important here.

A project does not need metro in its package.json directly installed, and thus the metro plugin is not activated, and the metro config file is reported as unused. Reference: https://docs.expo.dev/guides/customizing-metro/
Babel is in a similar situation, although in all of the RN/expo projects I've seen where babel.config.js was explicitly added (neither is required, but for customization it's supported), @babel/transform and others were directly depended upon, so it's not as useful to infer in my opinion.

I was looking at the existing expo and metro plugins, and my current best idea is to add expo to the enablers of the metro plugin - but it's possible that there is a better way, hence this issue instead of a PR. Let me know if this is the right approach, or I'd missed a way to cross-reference plugins, happy to add it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions