ionic-team / capacitor

Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
https://capacitorjs.com
MIT License
11.24k stars 955 forks source link

[Bug]: duplicate values in `packageClassList` #7422

Closed tafelnl closed 3 weeks ago

tafelnl commented 3 weeks ago

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0

Installed Dependencies:

  @capacitor/cli: 6.0.0
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0
  @capacitor/core: 6.0.0

Other API Details

Node: v20.12.2
NPM: 10.5.0

Platforms Affected

Current Behavior

Create a fresh Capacitor project. Install any non first party Capacitor plugin (for example @capacitor-community/in-app-review). Run npx cap sync. You will see the value InAppReviewPlugin appearing twice in the packageClassList parameter in ios/App/App/capacitor.config.json.

Expected Behavior

Since it's a new feature (at least, I think, because I've never seen it before) I'm not sure what the expected behaviour should be actually. But looking at the output for first party Capacitor plugins, I think it's expected to only have one value inside the packageClassList for each plugin.

Project Reproduction

.

Additional Information

No response

ionitron-bot[bot] commented 3 weeks ago

This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed. Please see the Contributing Guide for how to create a Sample App. Thanks! Ionitron 💙

tafelnl commented 3 weeks ago

I'm sorry, I won't be having time to create a reproduction soon. In all sincerity, it's also of no importance to me to get this issue fixed. So you're on your own for this one

bc-m commented 3 weeks ago

Got the same issue after upgrading to Capacitor 6, removing @capacitor-community/barcode-scanner and installing @capacitor-mlkit/barcode-scanning.

ios/App/App/capacitor.config.json

{
    "appId": "APP_ID_REMOVED",
    "appName": "APP_NAME_REMOVED",
    "webDir": "www",
    "server": {
        "androidScheme": "http"
    },
    "plugins": {
        "PushNotifications": {
            "presentationOptions": [
                "badge",
                "sound",
                "alert"
            ]
        }
    },
    "packageClassList": [
        "BarcodeScannerPlugin",
        "BarcodeScannerPlugin",
        "AppPlugin",
        "CAPBrowserPlugin",
        "ClipboardPlugin",
        "PreferencesPlugin",
        "PushNotificationsPlugin",
        "SplashScreenPlugin"
    ]
}

npx cap doctor

Latest Dependencies:

  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0

Installed Dependencies:

  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0
bc-m commented 3 weeks ago

Reproduction

mkdir cap-repro-issue-7422
cd cap-repro-issue-7422
npm init --yes
git init
mkdir ./www
echo "<h1>hello world</1>" > ./www/index.html
npm install @capacitor-mlkit/barcode-scanning @capacitor/app @capacitor/core @capacitor/ios @capacitor/cli typescript
npx cap init "MyApp" "com.capacitor.app" --web-dir "www"
npx cap add ios
npx cap sync

cat ios/App/App/capacitor.config.json

Execute above bash-script and you will see an duplicate BarcodeScannerPlugin entry in packageClassList array, like this:

{
        "appId": "com.capacitor.app",
        "appName": "MyApp",
        "webDir": "www",
        "packageClassList": [
                "BarcodeScannerPlugin",
                "BarcodeScannerPlugin",
                "AppPlugin"
        ]
}