ember-polyfills / ember-cached-decorator-polyfill

Polyfill for RFC 566: @cached
MIT License
20 stars 6 forks source link

0.1.2 incompatible with addon usage #79

Closed runspired closed 3 years ago

runspired commented 3 years ago

To reproduce:

ember addon bug
cd bug
yarn add ember-cached-decorator-polyfill
ember build

Result

Build Error (Analyzer)

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": "/Users/runspired/github/temp/bug/node_modules/ember-cached-decorator-polyfill/lib/transpile-modules.js",
    "dirname": "/Users/runspired/github/temp/bug",
    "ownPass": false,
    "file": {
      "request": "/Users/runspired/github/temp/bug/node_modules/ember-cached-decorator-polyfill/lib/transpile-modules.js",
      "resolved": "/Users/runspired/github/temp/bug/node_modules/ember-cached-decorator-polyfill/lib/transpile-modules.js"
    }
  },
  {
    "alias": "/Users/runspired/github/temp/bug/node_modules/ember-cached-decorator-polyfill/lib/transpile-modules.js",
    "dirname": "/Users/runspired/github/temp/bug",
    "ownPass": false,
    "file": {
      "request": "/Users/runspired/github/temp/bug/node_modules/ember-cached-decorator-polyfill/lib/transpile-modules.js",
      "resolved": "/Users/runspired/github/temp/bug/node_modules/ember-cached-decorator-polyfill/lib/transpile-modules.js"
    }
  }
]

Stack Trace and Error Report: /var/folders/4q/mm5h2b_j0k743zhh3660przr0000gn/T/error.dump.824bc958ee0e4fc00b8b4e0b68e7152e.log
runspired commented 3 years ago

I believe the issue is this line https://github.com/ember-polyfills/ember-cached-decorator-polyfill/blob/45ed313936c0ae252946439f51139a23564446d7/index.js#L18

not only is it misspelled (missing the d in cached), but looking at how hasPlugin works likely this needs to be the fully resolved path.

    if (!hasPlugin(app, 'ember-cache-decorator-polyfill')) {
rwjblue commented 3 years ago

Released in https://github.com/ember-polyfills/ember-cached-decorator-polyfill/releases/tag/v0.1.3