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): require.resolve(m/package.json) is not guarunteed to work for modern module format #10497

Merged

Conversation

AgentEnder
Copy link
Member

Current Behavior

Packages that use exports in package.json cause errors during migration

Expected Behavior

We are able to resolve the package.json location regardless of module format

Related Issue(s)

Fixes #

@nx-cloud
Copy link

nx-cloud bot commented May 27, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 8ecb974. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 12 targets

Sent with 💌 from NxCloud.

@vercel
Copy link

vercel bot commented May 27, 2022

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

Name Status Preview Updated
nx-dev ✅ Ready (Inspect) Visit Preview Jun 3, 2022 at 8:20PM (UTC)

const packageJson = readJsonFile(packageJsonPath);

if (!(packageJson.name === moduleSpecifier)) {
throw new Error(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't happen. This would occur if for some reason require.resolve(packageName) pointed to a folder that didn't have a moduleName. Its a safety guard, but thats it.

packages/nx/src/utils/package-json.ts Outdated Show resolved Hide resolved
packages/nx/src/utils/package-json.ts Outdated Show resolved Hide resolved
@AgentEnder AgentEnder force-pushed the fix/unable-to-resolve-package-json branch from 4d9ed07 to 5e77f13 Compare May 27, 2022 21:59
@AgentEnder AgentEnder force-pushed the fix/unable-to-resolve-package-json branch from 5e77f13 to 4bcfeac Compare May 27, 2022 23:17
@AgentEnder AgentEnder force-pushed the fix/unable-to-resolve-package-json branch from 4bcfeac to 39ed34e Compare May 31, 2022 21:22
@AgentEnder AgentEnder force-pushed the fix/unable-to-resolve-package-json branch from d0d952f to 9d780fc Compare June 1, 2022 15:19
@AgentEnder AgentEnder force-pushed the fix/unable-to-resolve-package-json branch from 9d780fc to 161d63e Compare June 1, 2022 15:34
@AgentEnder AgentEnder force-pushed the fix/unable-to-resolve-package-json branch from 161d63e to 02b2c29 Compare June 1, 2022 16:30
@AgentEnder AgentEnder force-pushed the fix/unable-to-resolve-package-json branch from 02b2c29 to 1ec8e46 Compare June 1, 2022 17:08
@AgentEnder AgentEnder force-pushed the fix/unable-to-resolve-package-json branch from 1ec8e46 to 09db34b Compare June 1, 2022 18:28
@FrozenPandaz FrozenPandaz enabled auto-merge (squash) June 3, 2022 20:52
@FrozenPandaz FrozenPandaz merged commit 7f7bc1a into nrwl:master Jun 3, 2022
@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 Mar 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants