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

Resolve duplicate entries #81

Closed
blainekasten opened this issue Aug 30, 2018 · 2 comments
Closed

Resolve duplicate entries #81

blainekasten opened this issue Aug 30, 2018 · 2 comments

Comments

@blainekasten
Copy link

blainekasten commented Aug 30, 2018

I just ran the babel-upgrade command. However, the output resulted in one plugin being set twice, which when running build threw an error about their being a duplicate plugin.

Ideally, this babel-upgrade plugin would check for duplicate entries and remove.

here was my previous .babelrc, and .after

Before

{
  "plugins": [
    "syntax-dynamic-import",
    "inline-react-svg",
    ["babel-plugin-styled-components", { "ssr": true, "displayName": false }]
  ],
  "presets": [
    [
      "env",
      {
        "targets": {
          "browsers": ["firefox >= 52"]
        },
        "modules": false
      }
    ],
    "stage-2",
    "flow",
    "react"
  ],
  "env": {
    "development": {
      "plugins": ["babel-plugin-idx"]
    },
    "production": {
      "plugins": ["babel-plugin-idx"]
    },
    "test": {
      "presets": [["env"], "react", "stage-2", "flow"],
      "plugins": ["transform-es2015-modules-commonjs"]
    }
  }
}

After

{
  "plugins": [
    "@babel/plugin-syntax-dynamic-import",
    "inline-react-svg",
    ["babel-plugin-styled-components", { "ssr": true, "displayName": false }],
    "@babel/plugin-syntax-dynamic-import",
    "@babel/plugin-syntax-import-meta",
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-json-strings",
    [
      "@babel/plugin-proposal-decorators",
      {
        "legacy": true
      }
    ],
    "@babel/plugin-proposal-function-sent",
    "@babel/plugin-proposal-export-namespace-from",
    "@babel/plugin-proposal-numeric-separator",
    "@babel/plugin-proposal-throw-expressions"
  ],
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "browsers": ["firefox >= 52"]
        },
        "modules": false
      }
    ],
    "@babel/preset-flow",
    "@babel/preset-react"
  ],
  "env": {
    "development": {
      "plugins": ["babel-plugin-idx"]
    },
    "production": {
      "plugins": ["babel-plugin-idx"]
    },
    "test": {
      "presets": [
        ["@babel/preset-env"],
        "@babel/preset-react",
        "@babel/preset-flow"
      ],
      "plugins": [
        "@babel/plugin-transform-modules-commonjs",
        "@babel/plugin-syntax-dynamic-import",
        "@babel/plugin-syntax-import-meta",
        "@babel/plugin-proposal-class-properties",
        "@babel/plugin-proposal-json-strings",
        [
          "@babel/plugin-proposal-decorators",
          {
            "legacy": true
          }
        ],
        "@babel/plugin-proposal-function-sent",
        "@babel/plugin-proposal-export-namespace-from",
        "@babel/plugin-proposal-numeric-separator",
        "@babel/plugin-proposal-throw-expressions"
      ]
    }
  }
}

Diff that came from babel-upgrade (truncated)

npx: installed 192 in 4.186s
🙌  Thanks for trying out https://github.com/babel/babel-upgrade!

Updating .babelrc config at .babelrc
Index: .babelrc
===================================================================
--- .babelrc	Before Upgrade
+++ .babelrc	After Upgrade
@@ -1,19 +1,33 @@
 {
   "plugins": [
-    "syntax-dynamic-import",
+    "@babel/plugin-syntax-dynamic-import",
     "inline-react-svg",
     [
       "babel-plugin-styled-components",
       {
         "ssr": true,
         "displayName": false
       }
-    ]
+    ],
+    "@babel/plugin-syntax-dynamic-import",
+    "@babel/plugin-syntax-import-meta",
+    "@babel/plugin-proposal-class-properties",
+    "@babel/plugin-proposal-json-strings",
+    [
+      "@babel/plugin-proposal-decorators",
+      {
+        "legacy": true
+      }
+    ],
+    "@babel/plugin-proposal-function-sent",
+    "@babel/plugin-proposal-export-namespace-from",
+    "@babel/plugin-proposal-numeric-separator",
+    "@babel/plugin-proposal-throw-expressions"

Duplicated "@babel/plugin-syntax-dynamic-import"

@ljharb
Copy link
Member

ljharb commented Aug 30, 2018

Duplicate of #77, fixed by #80?

@blainekasten
Copy link
Author

Classic noob not looking through the issues or pull requests... Thanks @ljharb

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

No branches or pull requests

2 participants