mainmatter/ember-test-selectors

v7 breaks applications using ember-cli-babel v8 and multiple addons using this package

Opened this issue · 0 comments

Hi there

With v7 of this package ember-cli-babel v8 support was added which is awesome! However, I've noticed that the build will break as soon as your application uses multiple addons that have a dependency on ember-test-selectors because the babel plugin is duplicated:

Duplicate plugin/preset detected.
If you'd like to use two separate instances of a plugin,
they need separate names, e.g.

  plugins: [
    ['some-plugin', {}],
    ['some-plugin', {}, 'some unique name'],
  ]

Duplicates detected are:
[
  {
    "alias": "/home/jimmy/work/ebau/camac-ng/node_modules/.pnpm/ember-test-selectors@7.0.0_@babel+core@7.25.2/node_modules/ember-test-selectors/strip-data-test-properties-plugin6.js",
    "dirname": "/home/jimmy/work/ebau/camac-ng/ember-ebau",
    "ownPass": false,
    "file": {
      "request": "/home/jimmy/work/ebau/camac-ng/node_modules/.pnpm/ember-test-selectors@7.0.0_@babel+core@7.25.2/node_modules/ember-test-selectors/strip-data-test-properties-plugin6.js",
      "resolved": "/home/jimmy/work/ebau/camac-ng/node_modules/.pnpm/ember-test-selectors@7.0.0_@babel+core@7.25.2/node_modules/ember-test-selectors/strip-data-test-properties-plugin6.js"
    }
  },
  {
    "alias": "/home/jimmy/work/ebau/camac-ng/node_modules/.pnpm/ember-test-selectors@7.0.0_@babel+core@7.25.2/node_modules/ember-test-selectors/strip-data-test-properties-plugin6.js",
    "dirname": "/home/jimmy/work/ebau/camac-ng/ember-ebau",
    "ownPass": false,
    "file": {
      "request": "/home/jimmy/work/ebau/camac-ng/node_modules/.pnpm/ember-test-selectors@7.0.0_@babel+core@7.25.2/node_modules/ember-test-selectors/strip-data-test-properties-plugin6.js",
      "resolved": "/home/jimmy/work/ebau/camac-ng/node_modules/.pnpm/ember-test-selectors@7.0.0_@babel+core@7.25.2/node_modules/ember-test-selectors/strip-data-test-properties-plugin6.js"
    }
  }
]

I think the right solution would be to only add the plugin to the babel options if it doesn't exist yet. However, I don't have any experience with babel plugins so I'd appreciate your help!