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

This experimental syntax requires enabling the parser plugin: 'objectRestSpread' #10345

Open
scrossan-crown opened this issue Aug 16, 2019 · 8 comments

Comments

@scrossan-crown
Copy link

commented Aug 16, 2019

Bug Report

Current Behavior
I'm getting the below error and I've been trying for hours to solve it with different plugins and options but haven't gotten anywhere.
/app/node_modules/comlink/dist/esm/comlink.mjs:64:12: This experimental syntax requires enabling the parser plugin: 'objectRestSpread' (64:12)

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

module.exports = function(api) {
    api.cache(true);

    const presets = [
        
        [
            "@babel/preset-env", 
            {
                "targets": {
                    "browsers": ["last 1 Chrome version"]
                },
                "shippedProposals": true
            }
        ],
        "@babel/preset-react"
    ];

    const plugins =  [
        [
            "@babel/plugin-transform-runtime",
            {
                "regenerator": true
            },
        ],
        "@babel/plugin-proposal-object-rest-spread",
        "@babel/plugin-transform-spread",
        "@babel/plugin-syntax-object-rest-spread"
    ];

    const parserOpts = {
        "plugins": ["objectRestSpread"] 
    };

    return {
        presets,
        plugins,
        parserOpts
    };
};

Environment

  • Babel version(s): 7.5.5
  • Node/npm version: Node 10
  • OS: Debian GNU/Linux 8 (jessie)
  • Monorepo: No
  • How you are using Babel: Via Parceljs

Additional context/Screenshots
image

@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Aug 16, 2019

Hey @scrossan-crown! 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.

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented Aug 16, 2019

It is because Parcel doesn't support JavaScript configs: parcel-bundler/parcel#2110

@scrossan-crown

This comment has been minimized.

Copy link
Author

commented Aug 16, 2019

@nicolo-ribaudo Thanks. I've converted it to a .babelrc and still get the same error

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "browsers": [
            "last 1 Chrome version"
          ]
        },
        "shippedProposals": true
      }
    ],
    "@babel/preset-react"
  ],
  "plugins": [
    [
      "@babel/plugin-transform-runtime",
      {
        "regenerator": true
      },
    ],
    "@babel/plugin-syntax-object-rest-spread"
  ]
}
@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented Aug 16, 2019

That's because Babel only uses babel.config.js, which is the recommended config, to transpile dependencies. .babelrc is local to your own package.

Since Parcel doesn't support babel.config.js, it does some magic to allow you to config Babel for your dependencies, but it only works sometimes: parcel-bundler/parcel#2304

Anyway, plase ensure that Babel is updated: the objectRestSpread parser option (and @babel/plugin-syntax-object-rest-spread) aren't needed since v7.1.5, which is 8 months old: 24c4901

@scrossan-crown

This comment has been minimized.

Copy link
Author

commented Aug 16, 2019

@nicolo-ribaudo I thought it was no longer needed. I've but a snippet of my package.json below.

 "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/plugin-proposal-object-rest-spread": "^7.5.5",
    "@babel/plugin-syntax-object-rest-spread": "^7.2.0",
    "@babel/plugin-transform-runtime": "^7.2.0",
    "@babel/plugin-transform-spread": "^7.2.2",
    "@babel/preset-env": "^7.5.5",
    "@babel/preset-react": "^7.0.0",
@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented Aug 16, 2019

Try running npx nls why @babel/parser

@scrossan-crown

This comment has been minimized.

Copy link
Author

commented Aug 16, 2019

@nicolo-ribaudo I ran npx nls why @babel/parser and the output is in the below gist . There is a lot of line a left out as there was so much for jest-cli.

https://gist.github.com/scrossan-crown/b262e8ce808114eb4b9f76e71cba594f

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented Aug 16, 2019

Ok, as you can see some packages are using an older version.

Try running npm update @babel/parser --depth=9999 or yarn upgrade @babel/parser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.