Why do I need to add dependencies' babel plugin to my project?

Viewed 1130

The original quesiont was put on github issue: https://github.com/babel/babel/issues/5803, but seems no response, so I think stackoverflow would be better place to ask:

The problem is:

When I add third party react component to my project, I always find out this:

Module build failed: ReferenceError: Unknown plugin "transform-object-assign" specified in "/Users/apple/Documents/.../react-z/node_modules/react-slick/.babelrc" at 0, attempted to resolve relative to

The third party component that I imported needs a babel plugin that I don't need.

I can add to my project, of course, then I add another third party react component, which needs babel-plugin-transform-replace-object-assign.

This quite embarrasses me that they do similar things, but I need to add them both to my project to make them work.

{
  "presets": [
    "es2015",
    "react",
    "stage-0"
  ],
  "plugins": [
    "transform-object-rest-spread",
    "transform-object-assign",
    [
      "transform-replace-object-assign",
      "object.assign"
    ]
  ]
}

Can someone explain why or show me how to do it in right way?

Thanks a lot.

1 Answers
Related