-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: remove implicit dependencies handling #9010
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 1fb9db1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
… and NpmNodeModulesCollector
The HoistedNodeModuleTest did not run, and there are several others under this category that were also skipped. This might be caused by issues with parallel testing. @mmaietta When you have time, could you help take a look at this?
|
…lector and PnpmNodeModulesCollector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two cases:
-
two packages json(newly added)
-
npm tar
I manually compared the
npm tar
, and there are no issues. The previous collection algorithm had a problem, as it included some unnecessary packages.
1fb9db1
to
212eba2
Compare
@@ -7,15 +7,12 @@ export interface NodeModuleInfo { | |||
|
|||
export type ParsedDependencyTree = { | |||
readonly name: string | |||
readonly from: string // for pnpm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be more appropriate in PnpmDependency
since that extends ParsedDependencyTree
already?
fix #9000 and #9006
Root Cause
It directly copies
node_modules
into the app directory and removesdevDependencies
frompackage.json
. This way,npm list
can retrieve all dependencies. However, during the lookup process, if there are duplicate dependency packages, somedependencies
innpm
may be empty. A previous fix(#8864 ) introduced the concept ofimplicit dependencies
to address this issue, but it only handled the first level ofimplicit dependencies
. Ifimplicit dependencies
themselves contain furtherimplicit dependencies
, the problem described in #9000 will occur.How to fix
The current approach directly searches the
parsedTree
and updates the globalthis.productionGraph
. If there are cases wheredependencies
are empty, it retrieves the same dependency fromallDependencies
and performs a lookup for sub-dependencies. If the dependency already exists inthis.productionGraph
, no further lookup is performed. Additionally, to prevent infinite loops, an empty array is set before searching for sub-dependencies.Now that one tree lookup has been eliminated, there will be a certain improvement in performance.