question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

babel-core doesn't list which plugins/presets are duplicated

See original GitHub issue

Bug Report

Current Behavior babel-core doesn’t list which plugins/presets are 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'],
      ]

      at assertNoDuplicates (node_modules/@babel/core/lib/config/config-descriptors.js:205:13)
      at createDescriptors (node_modules/@babel/core/lib/config/config-descriptors.js:114:3)
      at createPluginDescriptors (node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
      at alias (node_modules/@babel/core/lib/config/config-descriptors.js:63:49)
      at cachedFunction (node_modules/@babel/core/lib/config/caching.js:33:19)
      at plugins.plugins (node_modules/@babel/core/lib/config/config-descriptors.js:28:77)
      at mergeChainOpts (node_modules/@babel/core/lib/config/config-chain.js:319:26)
      at node_modules/@babel/core/lib/config/config-chain.js:283:7
      at buildRootChain (node_modules/@babel/core/lib/config/config-chain.js:68:29)
      at loadPrivatePartialConfig (node_modules/@babel/core/lib/config/partial.js:85:55)

Expected behavior/code A list of duplicate plugins/presets so that you know which ones to remove or rename.

Babel Configuration (.babelrc, package.json, cli command)

  "babel": {
    "plugins": [
      "@babel/plugin-proposal-class-properties",
      "@babel/plugin-syntax-dynamic-import",
      "@babel/plugin-transform-runtime",
      "babel-plugin-istanbul",
      "babel-plugin-styled-components",
      "syntax-export-extensions"
    ],
    "presets": [
      ["@babel/preset-env", {
        "debug": true
      }],
      ["@babel/preset-react", { "debug":  true }]
    ]
  },

Environment

  • Babel version(s): 7.4.0
  • Node/npm version: Node 10/npm 6
  • OS: macOS 10.14.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolo-ribaudocommented, Jun 10, 2019

You should probably exclude the object rest-spread plugin from @babel/preset-env

0reactions
luminous3commented, Jun 10, 2019

That actually fixed the error, thanks @nicolo-ribaudo

Read more comments on GitHub >

github_iconTop Results From Across the Web

Babel 7 fails with single plugin saying "Duplicate plugin/preset ...
This is a babel error basically saying that you have defined your plugin ... These presets in general are just shareable list of...
Read more >
Options - Babel.js
Note: The format of presets is identical to plugins, except for the fact that name normalization expects "preset-" instead of "plugin-", and presets...
Read more >
babel-loader - webpack
npm install -D babel-loader @babel/core @babel/preset-env webpack ... file directory if no node_modules folder could be found in any root directory.
Read more >
babel-loader - npm
npm install -D babel-loader @babel/core @babel/preset-env webpack ... to the default OS temporary file directory if no node_modules folder ...
Read more >
@babel/plugin-transform-runtime · Babel 中文网
If you need to polyfill them, you can directly import "core-js" or use @babel/preset-env 's useBuiltIns option. Installation. Install it as development ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found