Skip to content

using folder name for identity causes conflicts #10054

@jcesarmobile

Description

@jcesarmobile

Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?

  • Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands, swift build, swift test, swift package etc.

Description

Using folder name for local packages identity causes conflicts when multiple packages are in a folder with the same name.

You can see two different Capacitor plugins with different names, i.e.
https://github.com/capacitor-community/device/blob/master/Package.swift#L5
https://github.com/ionic-team/capacitor-plugins/blob/main/device/Package.swift#L5

Since Capacitor installs plugins from npm, despite their Package names are different, they are installed locally from node_modules and they both have device as containing folder due to how npm works.

I saw this similar issue related to remote dependencies
#8471

But in this case it doesn't need to be dependencies, just local packages with different names but in a folder with the same name.

Expected behavior

It should use the defined name in the Package.swift instead of the folder name.

Actual behavior

Conflicting identity for device: dependency 'node_modules/@capacitor/device' and dependency 'node_modules/@capacitor-community/device' both point to the same package identity 'device'.

Steps to reproduce

  1. clone repository https://github.com/jcesarmobile/devicecollision

  2. run npm install

  3. run npm run build

  4. run npx cap sync

  5. run npx cap open ios
    That opens Xcode, see that the dependencies are not added

  6. run cd ios/App/CapApp-SPM/

  7. run swift build
    You'll see the conflicting identity message

Swift Package Manager version/commit hash

No response

Swift & OS version (output of swift --version ; uname -a)

swift-driver version: 1.127.15 Apple Swift version 6.2.4 (swiftlang-6.2.4.1.4 clang-1700.6.4.2)
Target: arm64-apple-macosx15.0
Darwin OS-M2FLFJX2V2 24.6.0 Darwin Kernel Version 24.6.0: Mon Jan 19 22:01:58 PST 2026; root:xnu-11417.140.69.708.3~1/RELEASE_ARM64_T6041 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions