Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Babel 7 Upgrading creating error: "TypeError: Cannot assign to read only property 'exports' of object '#<Object>'"

Tags:

babeljs

I'm in the process of upgrading from babel 6 to babel 7. Some of my old tests using chai, sinon, and enzyme come up with the following error:

TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

I do have some code that is using "require" instead of "export" and I know that the babel 7 documentation says that you might need to use "require().default" instead. But that doesn't seem to be helping.(Or I just need to finish putting defaults everywhere and calling them before any the errors will go away). Does anyone else have experience with this issue?

like image 303
Kamala Phoenix Avatar asked Dec 17 '22 20:12

Kamala Phoenix


1 Answers

Try not to mix require / module.exports and import / export, ensure to be consistent with one.

like image 184
Abdulfatai Avatar answered Jun 13 '23 23:06

Abdulfatai