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

Property name expected type of string but got null [Error] #391

Closed
jeremytenjo opened this issue Apr 13, 2020 · 8 comments
Closed

Property name expected type of string but got null [Error] #391

jeremytenjo opened this issue Apr 13, 2020 · 8 comments

Comments

@jeremytenjo
Copy link

jeremytenjo commented Apr 13, 2020

Following code produces the error:

const hello = async () => {
  const he = { ll: '2' }
  const { ll } = he
}

babel config

module.exports = {
  presets: [
    [
      require('@babel/preset-env'),
      {
        targets: 'defaults, not ie <= 11, not edge > 0, not IE_Mob 11',
        modules: false
      }
    ],
    require('@babel/preset-react')
  ],
  plugins: [
    require('react-hot-loader/babel'),
    require('@babel/plugin-transform-regenerator'),
    require('@babel/plugin-syntax-dynamic-import'),
    require('@babel/plugin-syntax-throw-expressions'),
    require('@babel/plugin-transform-runtime'),
    require('babel-plugin-styled-components')
  ],
  env: {
    production: {
      plugins: [require('babel-plugin-transform-react-remove-prop-types')]
    }
  }
}

package.json

  "dependencies": {
    "@babel/core": "^7.9.0",
    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
    "@babel/plugin-syntax-throw-expressions": "^7.8.3",
    "@babel/plugin-transform-regenerator": "^7.8.7",
    "@babel/plugin-transform-runtime": "^7.9.0",
    "@babel/preset-env": "^7.9.0",
    "@babel/preset-react": "^7.9.4",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^25.1.0",
    "babel-loader": "^8.1.0",
    "babel-plugin-styled-components": "^1.10.7",
    "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
    "react-hot-loader": "^4.12.20"
  },

node version v12.13.1

Thanks

More context #390

@nicolo-ribaudo
Copy link
Contributor

@tenjojeremy / @liuliangsir All the browsers with destructuring support also support generators. What is the use case for regenerator when you are not transpiling destructuring?

@jeremytenjo
Copy link
Author

@nicolo-ribaudo I removed this package and my app still works, turn out I wasn't using it correctly but don't need it. I no longer need the fix but it seems other people do.

@liuliangsir
Copy link

I removed this package and my app still works

@tenjojeremy , which package? Sadly, I have been running into the issue above for some time. Here is a minimal reproducible example.

@jeremytenjo
Copy link
Author

jeremytenjo commented Apr 21, 2020

I removed require('@babel/plugin-transform-regenerator')

@nicolo-ribaudo
Copy link
Contributor

@liuliangsir Does your targets support destructuring?

  • Yes -> Then they also support generators, so you can remove @babel/plugin-transform-regenerator
  • No -> Then you need to add @babel/plugin-transform-destructuring

@jeremytenjo
Copy link
Author

#391 (comment) solves the issue

@MwumLi
Copy link

MwumLi commented Jul 8, 2022

@liuliangsir Does your targets support destructuring?

  • Yes -> Then they also support generators, so you can remove @babel/plugin-transform-regenerator
  • No -> Then you need to add @babel/plugin-transform-destructuring

@nicolo-ribaudo if targets support destructuring, why is this error reported when add @babel/plugin-transform-regenerator

@nicolo-ribaudo
Copy link
Contributor

Because this plugin assumes that destructuring has been compiled. What's your use case for compiling generators but not destructuring?

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

4 participants