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(node): npm modules are not resolved correctly #9284

Merged
merged 1 commit into from Mar 18, 2022

Conversation

hellivan
Copy link
Contributor

Current Behavior

The current implementation of the node executor resolves all npm modules that are referenced by the application from the root node_modules folder. This behavior leads to runtime errors if any of the project dependencies requires a different version off package than the project itself.

For example, if we have a project that depends on express in version 4.17.3 (which on the other hand depends on path-to-regexp version 0.1.7) as well as on path-to-regexp in version 6.2.0. In such case express will throw a runtime error since it would load path-to-regexp version 6.2.0 which is not API compatible.

Expected Behavior

Node executor should not add resolve mappings for npm modules at all.

@vercel
Copy link

vercel bot commented Mar 11, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nrwl/nx-dev/9rpo3kgwfWj4C6AvSSEerXemda1A
✅ Preview: Canceled

[Deployment for 5cc29a2 canceled]

@hellivan hellivan changed the title fix(node): npm modules are note resolved correctly fix(node): npm modules are not resolved correctly Mar 11, 2022
The current implementation of the node executor resolves all npm
modules that are referenced by the application from the root
node_modules folder. This behavior leads to runtime errors if any of
the project dependencies requires a different version of a package
than the project itself.

For example, if we have a project that depends on `express` in version
`4.17.3` (which on the other hand depends on `path-to-regexp` version
`0.1.7`) as well as on `path-to-regexp` in version `6.2.0`. In such
case `express` will throw a runtime error since it would load
`path-to-regexp` version `6.2.0` which is not API compatible.

For this reason, this commit changes the behavior of the node-executor
so that it completely ignores npm dependencies when calculating
resolve mappings.
Copy link
Collaborator

@FrozenPandaz FrozenPandaz left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! LGTM 🎉

@FrozenPandaz FrozenPandaz merged commit 3824eeb into nrwl:master Mar 18, 2022
FrozenPandaz pushed a commit that referenced this pull request Mar 21, 2022
The current implementation of the node executor resolves all npm
modules that are referenced by the application from the root
node_modules folder. This behavior leads to runtime errors if any of
the project dependencies requires a different version of a package
than the project itself.

For example, if we have a project that depends on `express` in version
`4.17.3` (which on the other hand depends on `path-to-regexp` version
`0.1.7`) as well as on `path-to-regexp` in version `6.2.0`. In such
case `express` will throw a runtime error since it would load
`path-to-regexp` version `6.2.0` which is not API compatible.

For this reason, this commit changes the behavior of the node-executor
so that it completely ignores npm dependencies when calculating
resolve mappings.
@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 19, 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