Skip to content

Remove @babel/plugin-proposal-object-rest-spread from default babel configuration #7454

Open
@danderson00

Description

@danderson00

Is your proposal related to a problem?

This has been suggested in other issues (notably #5310) and pull requests (#5331). The pull request was closed with the comment:

Unfortunately, I still don't trust that this works correctly. There's zero harm in including this plugin to be safe, so let's leave it for now.

There are a couple of places where this causes "harm":

  • I am declaring Javascript expressions as parameters to higher order components, and these expressions are serialized and sent to the server. The object rest spread babel plugin injects a function call when using the rest operator in these expressions, causing them to fail to be interpreted and validated on the server.
  • Perhaps more relevant to more people, transforming this code can cause additional debugging pain. This is not a trivial issue.

The addition of the browsers option to package.json is awesome. I've been craving a "leave my code the $#@& alone" setting, and setting development mode to latest chrome is almost that, except for the rest operator, and it's a pain!

Describe the solution you'd like

Remove the inclusion of the @babel/plugin-proposal-object-rest-spread package by default.

require('@babel/plugin-proposal-object-rest-spread').default,

Describe alternatives you've considered

The obvious workaround is to use Object.assign, but this is an unnecessary restriction and prevents me from using a productive language feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions