Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): ensure require.resolve('nx') resolves correctly #19800

Merged

Conversation

ndcunningham
Copy link
Contributor

@ndcunningham ndcunningham commented Oct 23, 2023

Current Behavior

When you create a plugin that calls our internal executor for example require.resolve('nx') resolves to {workspaceRoot}/nx.json

This is because tsconfig-paths uses require.extensions which includes .json

    interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
        '.js': (m: Module, filename: string) => any;
        '.json': (m: Module, filename: string) => any;
        '.node': (m: Module, filename: string) => any;
    }

Expected Behavior

require.resolve('nx') should resolve to nx binary. For example located in node_modules/nx/bin/nx.js

Related Issue(s)

Filed an issue: dividab/tsconfig-paths#255

fixes: #19782

@ndcunningham ndcunningham self-assigned this Oct 23, 2023
@vercel
Copy link

vercel bot commented Oct 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Oct 23, 2023 7:07pm

@ndcunningham ndcunningham force-pushed the fix/react-mfe-dev-server-nx-resolution branch from 712aae1 to dce61a1 Compare October 23, 2023 18:18
@ndcunningham ndcunningham requested a review from a team as a code owner October 23, 2023 18:18
@ndcunningham ndcunningham added the scope: react Issues related to React support for Nx label Oct 23, 2023
@ndcunningham ndcunningham force-pushed the fix/react-mfe-dev-server-nx-resolution branch from dce61a1 to da94211 Compare October 23, 2023 18:23
@ndcunningham ndcunningham changed the title Fix/react mfe dev server nx resolution fix(react): ensure require.resolve('nx') resolves correctly Oct 23, 2023
@ndcunningham ndcunningham force-pushed the fix/react-mfe-dev-server-nx-resolution branch from da94211 to 2a5a867 Compare October 23, 2023 19:05
@ndcunningham ndcunningham requested a review from a team as a code owner October 23, 2023 19:05
@ndcunningham ndcunningham changed the title fix(react): ensure require.resolve('nx') resolves correctly fix(core): ensure require.resolve('nx') resolves correctly Oct 23, 2023
@ndcunningham ndcunningham force-pushed the fix/react-mfe-dev-server-nx-resolution branch from 2a5a867 to 83a40a4 Compare October 23, 2023 19:07
@ndcunningham ndcunningham merged commit 812cffe into nrwl:master Oct 23, 2023
2 checks passed
@ndcunningham ndcunningham deleted the fix/react-mfe-dev-server-nx-resolution branch October 23, 2023 20:09
FrozenPandaz pushed a commit that referenced this pull request Oct 25, 2023
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
scope: react Issues related to React support for Nx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@nx/react:module-federation-dev-server sets wrong nxBin when called from custom executor
3 participants