Skip to content

DevDependencies' dependencies are added to native project #2856

@petekanev

Description

@petekanev

The current implementation of the production dependencies filtering analyzes the project's package.json and traverses the production dependencies within node_modules. Once the production dependencies are figured out, only the top-level packages are copied to platforms/, because it is assumed that they will carry along their respective production dependencies.

The assumption works in the general case when installing a package through npm, a tarball, a github repo, however npm link wasn't taken into consideration, and in some rare cases linking to a global package that has its dev-dependencies installed will link them as well.

Proposed solution:
Filter prod. dependencies' dev packages by checking the package.jsons and excluding relative paths of the dev. dependencies.

Repro steps:

Follow the Getting Started steps of the plugin seed https://github.com/NativeScript/nativescript-plugin-seed/tree/ebf2d5eec4bb27a5db9248815c1fe2ee1898ac4c#3-getting-started
npm linked plugin will contain tns-core-modules as a result of it being locally developed and linked. And although it is a dev dependency, it will be brought along when the nativescript-my-plugin directory is symlinked.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions