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

Error: Duplicate plugin/preset detected when updating babel from 6.22 to 7.4 for react app #9953

Closed
Tianpei9 opened this issue May 7, 2019 · 2 comments
Labels
i: bug i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@Tianpei9
Copy link

Tianpei9 commented May 7, 2019

Bug Report

Current Behavior
A clear and concise description of the behavior.
Use npx babel-upgrade --write to update babel, but get this duplication issue, I check them but can't find which plugin or preset is duplicated
Input Code

  • REPL or Repo link if applicable:
    This is new .bablerc file
{
    "presets": [
        "@babel/preset-react",
        "@babel/preset-env",
        "@babel/env"
    ],
    "plugins": [
        ["@babel/plugin-proposal-object-rest-spread", {}, "unique-name-a"],
        ["@babel/plugin-syntax-dynamic-import", {}, "unique-name-b"],
        ["@babel/plugin-syntax-import-meta", {}, "unique-name-d"],
        ["@babel/plugin-proposal-class-properties", {}, "unique-name-c"],
        ["@babel/plugin-proposal-json-strings", {}, "unique-name-e"],
        [
            ["@babel/plugin-proposal-decorators", {}, "unique-name-p"],
            {
                "legacy": true
            }
        ],
        ["@babel/plugin-proposal-function-sent", {}, "unique-name-f"],
        ["@babel/plugin-proposal-export-namespace-from", {}, "unique-name-g"],
        ["@babel/plugin-proposal-numeric-separator", {}, "unique-name-h"],
        ["@babel/plugin-proposal-throw-expressions", {}, "unique-name-i"],
        ["@babel/plugin-proposal-export-default-from", {}, "unique-name-j"],
        ["@babel/plugin-proposal-logical-assignment-operators", {}, "unique-name-k"],
        ["@babel/plugin-proposal-optional-chaining", {}, "unique-name-l"],
        [
            ["@babel/plugin-proposal-pipeline-operator", {}, "unique-name-q"],
            {
                "proposal": "minimal"
            }
        ],
        ["@babel/plugin-proposal-nullish-coalescing-operator", {}, "unique-name-m"],
        ["@babel/plugin-proposal-do-expressions", {}, "unique-name-n"],
        ["@babel/plugin-proposal-function-bind", {}, "unique-name-o"],
    ]
}

webpack.config.js file: (didn't do any change)

const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const path = require('path')

module.exports = {
  devtool: 'source-map',
  entry: [
    'babel-polyfill',
    './public/scripts/main',
  ],
  module: {
    loaders: [
      {test: /.json$/, loader: 'json'},
      {test: /\.hbs$/, loader: 'handlebars'},
      {test: /.jsx?$/, loader: 'babel', exclude: /node_modules\/(?!ol)/},
    ],
  },
  output: {
    filename: 'bundle.js',
    path: `${__dirname}/public/scripts/`,
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: '"production"',
      },
    }),
    new webpack.IgnorePlugin(/regenerator|nodent|js-beautify/, /ajv/),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false,
      },
      dead_code: true,
      minimize: true,
    }),
  ],
  resolve: {
    extensions: [
      '',
      '.js',
      '.json',
      '.jsx',
    ],
    alias: {
      'ol': path.resolve(__dirname, './', 'node_modules/ol'),
      'react': path.resolve(__dirname, './', 'node_modules/react'),
      'react-dom': path.resolve(__dirname, './', 'node_modules/react-dom'),
      'styled-components': path.resolve(__dirname, './', 'node_modules/styled-components')
    }
  },
}

Expected behavior/code
A clear and concise description of what you expected to happen (or code).

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

Environment

  • Babel version(s): 7.00
  • Node/npm version: Node 8/npm 5]
  • OS: OSX 10.13.4
  • Monorepo: [e.g. yes/no/Lerna]
  • How you are using Babel: loader

Possible Solution

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.

@babel-bot
Copy link
Collaborator

Hey @Tianpei9! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@loganfsmyth
Copy link
Member

You do have the same thing.

        "@babel/preset-env",
        "@babel/env"

is the same preset listed twice, one just includes the preset- prefix and one doesn't.

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug i: needs triage outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

3 participants