apache / apache/cordova-cli

Plugins are not restored from package.json but only from config.xml

Open
#508 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
967
Forks
344
Avg merge
8h 41m
Merged PRs (30d)
9

Description

# Bug Report

## Problem

Plugins are not restored from `package.json`. They are only restored if listed in `config.xml` but since Cordova 9 plugins are to be managed with `package.json`.
Steps to recreate:

1. Create new app:
`cordova create testPluginRestore com.example.testpluginrestore TestPluginRestore`
2. Add platform:
`cordova platform add android`
3. Add plugin:
`cordova plugin add cordova-plugin-geolocation`
4. Check plugin added ok?
`cordova plugin ls` Lists plugin OK. Also entry in `package.json` is present.
5. Clean plugins and pltfroms
`rm -rf platforms/ plugins/ node_modules/`
6. Prepare android
`cordova prepare android`
7. Check plugins restored
`cordova plugin ls`

### What is expected to happen?
- cordova-plugin-geolocation plugin to be restored and listed in the list

### What does actually happen?
- cordova-plugin-geolocation is not restored.

## Information

The same behaviour was tested with other plugins `cordova-plugin-camera`,
`cordova-plugin-firebase-dynamiclinks`, and others with the same outcome.

### Command or Code

### Environment, Platform, Device

- Mac OS

### Version information

- Cordova CLI 9.0.0

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the listed cordova create, plugin add, cleanup, and cordova prepare android commands, then trace how prepare restores plugins from package.json versus config.xml. Done means cordova-plugin-geolocation and the other package-managed plugins are restored and listed by cordova plugin ls after cleanup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.