abdalla / react-hotjar

Small component to implement Hotjar into your react application
MIT License
165 stars 32 forks source link

Babel failing to transpile after bumping upto 5.5.0 #54

Closed abhikarsh-gupta closed 1 year ago

abhikarsh-gupta commented 1 year ago
./node_modules/react-hotjar/index.js 15:60
Module parse failed: Unexpected token (15:60)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|     },
|     initialized: function initialized() {
>       return typeof window !== 'undefined' && typeof window?.hj === 'function';
|     },
|     identify: function identify(userId, properties) {

Getting the above error when trying to start the application.

Configs:- CRA with no webpack config.

"react-scripts": "4.0.3",
"babel-plugin-preval": "^5.1.0",

Kindly look into the issue. Please let me know if more information is needed. Thanks!

jamesl1001 commented 1 year ago

Me too. It's caused by the optional chaining (?.) here: https://github.com/abdalla/react-hotjar/blob/master/index.js#L18

Downgrading to react-hotjar@5.4.1 has temporarily solved it for me.

Mihai-github commented 1 year ago

Hey, I came across the same problem ... the only solution is downgrading to react-hotjar@5.4.1?

abdalla commented 1 year ago

Hey guys, I have no time to get into this right now... PR is welcome!

abdalla commented 1 year ago

Could you try the v 6 ?

maxolasersquad commented 1 year ago

Could you try the v 6 ?

I was running into this problem as well. I upgraded to ^6.1.0 and the problem went away.