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

Duplicated plugin #77

Open
tpai opened this issue Aug 29, 2018 · 4 comments
Open

Duplicated plugin #77

tpai opened this issue Aug 29, 2018 · 4 comments
Labels
bug Something isn't working Has PR

Comments

@tpai
Copy link

tpai commented Aug 29, 2018

After run babel-upgrade, it create duplicate @babel/plugin-syntax-dynamic-import in .babelrc.

screen shot 2018-08-29 at 3 32 19 pm

Version: 0.0.23

@nicolo-ribaudo
Copy link
Member

What was your full original .babelrc?

@tpai
Copy link
Author

tpai commented Aug 29, 2018

Here it is.

{
  'presets': [
    ['env', {
      "targets": {
        "browsers": ["ie >= 11"]
      },
      "modules": false
    }],
    'stage-0',
    'react'
  ],
  'plugins': [
    'syntax-dynamic-import'
  ]
}

@nicolo-ribaudo nicolo-ribaudo added the bug Something isn't working label Aug 29, 2018
@nicolo-ribaudo
Copy link
Member

This happens because you had the syntax-dynamic-import plugin duplicated (once in the preset and once explicitly in your config).

If anyone wants to look at this issue, it's because we "eject" the stage presets by replacing them with the plugins that they enable, without checking if those plugins are already there.

@claytonrcarter
Copy link

Not sure if this is the same issue, but I just ran npx babel-upgrade --write --install and almost everything worked fine, except for the following:

input

...
      "presets": [
      [
        "es2015",
        {
          "modules": false
        }
      ],
      [
        "env",
        {
          "modules": false
        }
      ]
    ],
...

output

...
    "presets": [
      [
        "@babel/preset-env",
        {
          "modules": false
        }
      ],
      [
        "@babel/preset-env",
        {
          "modules": false
        }
      ]
    ],
...

As I ponder it, it may be that the input was suboptimal (Babel & the various stage configs sometimes seems like black magic to me), but it worked, and afterward, it didn't. Removing the duplicate entry fixed the problem and everything started working again.

Thank you for this utility! I spent 4 hours trying to upgrade manually this morning w/ no luck. I started over and, aside from this hiccup, this utility did the job in a few minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Has PR
Projects
None yet
Development

No branches or pull requests

3 participants