aamodtgroup / frontity-contact-form-7

Contact Form 7 extension for Frontity.
https://frontity-cf7.aamodtgroup.com/
GNU General Public License v2.0
10 stars 4 forks source link

TypeError: Cannot assign to read only property 'name' of function #1

Closed davidrhoderick closed 3 years ago

davidrhoderick commented 3 years ago

Great job on reviving and finishing this plugin from the earlier version.

I had a problem with a deployment today because of a new package I added (color) and ran rm -rf node_modules && rm -rf package-lock.json && rm -rf yarn-error.log && rm -rf yarn.lock && npm cache clean --force then npm install, which upgraded a couple packages (e.g., Frontity went to version 15).

Right after that, I brought up the site with npx frontity dev and got the following error:

TypeError: Cannot assign to read only property 'name' of function 'props=>{// Dummy setState to update the component.
const[,setState]=Object(react__WEBPACK_IMPORTED_MODULE_1__["...<omitted>...}}'
    at eval (webpack-internal:///./node_modules/@frontity/connect/src/connect.js:91:71)
    at Array.forEach (<anonymous>)
    at connect (webpack-internal:///./node_modules/@frontity/connect/src/connect.js:91:40)
    at eval (webpack-internal:///./node_modules/@aamodtgroup/frontity-contact-form-7/src/processors/cf7HiddenInputs.js:5:568)
    at Module../node_modules/@aamodtgroup/frontity-contact-form-7/src/processors/cf7HiddenInputs.js (/home/davidrhoderick/Development/pardo/pardo-frontity/build/server.js:283:1)
    at __webpack_require__ (/home/davidrhoderick/Development/pardo/pardo-frontity/build/server.js:27:30)
    at eval (webpack-internal:///./node_modules/@aamodtgroup/frontity-contact-form-7/src/index.js:9:85)
    at Module../node_modules/@aamodtgroup/frontity-contact-form-7/src/index.js (/home/davidrhoderick/Development/pardo/pardo-frontity/build/server.js:259:1)
    at __webpack_require__ (/home/davidrhoderick/Development/pardo/pardo-frontity/build/server.js:27:30)
    at eval (webpack-internal:///./build/bundling/entry-points/server.ts:7:104)

I don't really understand what's going on there and I found that if I comment out cf7HiddenInputs.js, I also get the error on cf7Span.js. If I comment out both those imports and remove them from the libraries, I don't get the error. Unfortunately, I can't confirm that the package works without those elements because the site I'm using it on is having other issues as per this post.

kasperaamodt commented 3 years ago

Hi,

I also noticed this a couple of days ago! I will start to look into it, hopefully someone in the Community have some insights. And thanks for the kind words. 😄

kasperaamodt commented 3 years ago

I noticed that the Span and HiddenInput processors used export default connect(), while the other processors only used export default. So I removed the connect, and it started to work again.

kasperaamodt commented 3 years ago

After the change, the package does not work at all. I believe it is a bug in the Frontity html2react package. I have reported it to the community here.

kasperaamodt commented 3 years ago

The package works now! 👍