Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate plugin/preset detected #453

Closed
bobisjan opened this issue May 13, 2020 · 10 comments · Fixed by #525
Closed

Duplicate plugin/preset detected #453

bobisjan opened this issue May 13, 2020 · 10 comments · Fixed by #525

Comments

@bobisjan
Copy link
Contributor

👋, with 0.16.1 the following error throws on rebuild

(node:59760) UnhandledPromiseRejectionWarning: ModuleBuildError: Module build failed (from /Users/bobisjan/Developer/zonky-app/node_modules/babel-loader/lib/index.js):
(node:59760) UnhandledPromiseRejectionWarning: ModuleBuildError: Module build failed (from /Users/bobisjan/Developer/zonky-app/node_modules/babel-loader/lib/index.js):
Error: 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/bobisjan/Developer/zonky-app/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js",
    "dirname": "/Users/bobisjan/Developer/zonky-app",
    "ownPass": false,
    "file": {
      "request": "/Users/bobisjan/Developer/zonky-app/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js",
      "resolved": "/Users/bobisjan/Developer/zonky-app/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js"
    }
  },
  {
    "alias": "/Users/bobisjan/Developer/zonky-app/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js",
    "dirname": "/Users/bobisjan/Developer/zonky-app",
    "ownPass": false,
    "file": {
      "request": "/Users/bobisjan/Developer/zonky-app/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js",
      "resolved": "/Users/bobisjan/Developer/zonky-app/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js"
    }
  }
]
    at assertNoDuplicates (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/config-descriptors.js:206:13)
    at createDescriptors (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/config-descriptors.js:114:3)
    at createPluginDescriptors (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
    at alias (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/config-descriptors.js:63:53)
    at cachedFunction (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/caching.js:62:27)
    at cachedFunction.next (<anonymous>:null:null)
    at evaluateSync (/Users/bobisjan/Developer/zonky-app/node_modules/gensync/index.js:244:28)
    at sync (/Users/bobisjan/Developer/zonky-app/node_modules/gensync/index.js:84:14)
    at plugins.plugins (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/config-descriptors.js:28:77)
    at mergeChainOpts (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/config-chain.js:319:26)
    at /Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/config-chain.js:283:7
    at Generator.next (<anonymous>:null:null)
    at buildRootChain (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/config-chain.js:68:36)
    at buildRootChain.next (<anonymous>:null:null)
    at loadPrivatePartialConfig (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/partial.js:95:62)
    at loadPrivatePartialConfig.next (<anonymous>:null:null)
    at Function.<anonymous> (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/partial.js:120:25)
    at Generator.next (<anonymous>:null:null)
    at evaluateSync (/Users/bobisjan/Developer/zonky-app/node_modules/gensync/index.js:244:28)
    at Function.sync (/Users/bobisjan/Developer/zonky-app/node_modules/gensync/index.js:84:14)
    at Object.<anonymous> (/Users/bobisjan/Developer/zonky-app/node_modules/@babel/core/lib/config/index.js:41:61)
    at Object.<anonymous> (/Users/bobisjan/Developer/zonky-app/node_modules/babel-loader/lib/index.js:151:26)
    at Generator.next (<anonymous>:null:null)
    at asyncGeneratorStep (/Users/bobisjan/Developer/zonky-app/node_modules/babel-loader/lib/index.js:3:103)
    at _next (/Users/bobisjan/Developer/zonky-app/node_modules/babel-loader/lib/index.js:5:194)
    at /Users/bobisjan/Developer/zonky-app/node_modules/babel-loader/lib/index.js:5:364
    at new Promise (<anonymous>:null:null)
    at Object.<anonymous> (/Users/bobisjan/Developer/zonky-app/node_modules/babel-loader/lib/index.js:5:97)
    at Object.loader (/Users/bobisjan/Developer/zonky-app/node_modules/babel-loader/lib/index.js:64:18)
    at Object.<anonymous> (/Users/bobisjan/Developer/zonky-app/node_modules/babel-loader/lib/index.js:59:12)
    at runLoaders (/Users/bobisjan/Developer/zonky-app/node_modules/@embroider/webpack/node_modules/webpack/lib/NormalModule.js:316:20)
    at /Users/bobisjan/Developer/zonky-app/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Users/bobisjan/Developer/zonky-app/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/Users/bobisjan/Developer/zonky-app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at loader.call.then.err (/Users/bobisjan/Developer/zonky-app/node_modules/babel-loader/lib/index.js:59:103)
@nightire
Copy link

nightire commented May 13, 2020

Do you have the latest ember-cli-typescript installed? If so, try to upgrade it to the beta alpha(4.0.0) version, I just solve this issue a few hours ago.

@ef4
Copy link
Contributor

ef4 commented May 14, 2020

Upgrading ember-cli-typescript may workaround this bug by not adding the duplicated babel plugins, but this is still a legit bug.

Embroider should check and avoid adding duplicates.

@rwjblue
Copy link
Collaborator

rwjblue commented May 14, 2020

One of the changes in ember-cli-typescript@4 is to use a little handshake to detect a new enough ember-cli-babel version and just let ember-cli-babel set up all the TS plugins instead of how it worked in 2.x and 3.x where ember-cli-typescript had to push the plugins.

That may work around the issue reported, since (IIRC) Embroider pulls the Babel options to use from ember-cli-babel...

@bobisjan
Copy link
Contributor Author

@nightire, application does not have direct dependency on ember-cli-typescript, but there are some add-ons, which have it as dependency ranging from 2.x to 3.x.

@NullVoxPopuli
Copy link
Collaborator

NullVoxPopuli commented May 24, 2020

Update: also with 0.19.0


I just witnessed this in 0.18.0, too.
My babel config is pretty minimal

my error is with @babel/plugin-proposal-optional-chaining, tho

@camerondubas
Copy link
Contributor

camerondubas commented May 26, 2020

Also experiencing the same thing with 0.18.0 and @babel/plugin-proposal-optional-chaining

Babel Config:

    babel: {
      plugins: [
        "@babel/plugin-proposal-nullish-coalescing-operator",
        "@babel/plugin-proposal-optional-chaining",
      ],
    },

@NullVoxPopuli
Copy link
Collaborator

output of yarn why, if that helps

$ yarn why @babel/plugin-proposal-optional-chaining
yarn why v1.22.4
[1/4] Why do we have the module "@babel/plugin-proposal-optional-chaining"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "@babel/[email protected]"
info Reasons this module exists
   - "_project_#ember-cli-typescript" depends on it
   - Hoisted from "_project_#ember-cli-typescript#@babel#plugin-proposal-optional-chaining"
   - Hoisted from "_project_#ember-cli-babel#@babel#preset-env#@babel#plugin-proposal-optional-chaining"
   - Hoisted from "_project_#emberclear#@embroider#webpack#@babel#plugin-proposal-optional-chaining"

@tleperou
Copy link

tleperou commented Jun 28, 2020

+1 address to this error.
(duplicates detected plugin-proposal-optional-chaining)

I got it with a fresh and empty Embroider project once I added typescript's support.

As @ef4 mentioned, upgrade to typescript 4-alpha did workaround.

@camerondubas
Copy link
Contributor

Still experiencing this in 0.22.0. I'm not using typescript.

My babel config (copied from my comment above):

    babel: {
      plugins: [
        "@babel/plugin-proposal-nullish-coalescing-operator",
        "@babel/plugin-proposal-optional-chaining",
      ],
    },

@GCheung55
Copy link
Contributor

Maybe a shorterm fix: embroider-build/ember-auto-import#283 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants