Skip to content

[feat] detect react version in monorepo #1109

@yidingww

Description

@yidingww

Describe the problem

Currently, the "detect" logic of react version is using module.createRequire(import.meta.url) or module.createRequire(process.cwd() + path.sep ) at packages/shared/src/_require.ts. And in a monorepo enviroment, when linting a file in a sub project from the project root directory, it will try to resolve react version in the from the project root:

# in ./ (project root)
npx eslint apps/xyz/App.tsx # this will create a `_require` that tries to resolve `./node_modules/react`

However, the actual react version it should resolve to is apps/node_modules/react...

Describe the solution you'd like

No response

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions