1

i keep getting the error:

 Module build failed (from ./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'],
  ]

this is my babelrc with the changes it is asking for:

{
"presets": [
  ["@babel/env"],
  ["@babel/preset-react"]
],
"plugins": [
    ["@babel/plugin-syntax-jsx"],
    ["@babel/plugin-transform-react-jsx"],
    ["@babel/plugin-transform-react-display-name"],
    ["@babel/plugin-transform-react-jsx-self"],
    ["@babel/plugin-transform-react-display-name"]
  ]

}

Not really sure where i have the wrong syntax for the file. Also this is my first time configuring webpack4 with babel for a react application. Please let me know if everything looks fine for this to work with react.

1
  • I see "plugin-transform-react-display-name" in your list twice. Commented Sep 2, 2018 at 4:13

1 Answer 1

3

Like the error says: you have a duplicate. ["@babel/plugin-transform-react-display-name"] is in your "plugins" array twice. Just delete one of them.


With that said: take a look at what's already included in preset-react (a preset is a pre-defined bundle of plugins). All of those plugins are already included (though "plugin-transform-react-jsx-self" is behind an option.)

Sign up to request clarification or add additional context in comments.

1 Comment

ahh ok thank you for that i completely misread it when i was looking up the preset

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.