This was a very enigmatic issue to track down. Recently, our NPM deps were updated, which included a major upgrade to parcel - from v1 to v2. Parcel v2 compiles code to JS modules and requires the type="module" attribute on the script tags when loading. Because the compiled assets were loaded as regular JS, it caused a TypeError when the script was executed.
Unfortunately, WP only added wp_enqueue_script_module in 6.5 (this year), and adding the type attribute in earlier WP versions requires some filtering. Even when I tried adding the type attribute, I ran into other issues.
The change to using modules requires far more QA than downgrading parcel at the moment, which is why this PR has chosen the latter. I suggest we circle back to upgrading parcel later when we have more time to dedicate to it.
QA
In one of the gateway plugins (such as ANet), require this branch of the FW
Go to My Account > Payment Methods
Click on "Edit" on any of the payment methods
[ ] The edit form works, edits are saved and there are no errors in console.
Summary
This release addresses an issue discovered in the 5.12.3 release, where bundled gateway scripts trigger errors.
Issue MWC-16791
Details
This was a very enigmatic issue to track down. Recently, our NPM deps were updated, which included a major upgrade to
parcel
- from v1 to v2. Parcel v2 compiles code to JS modules and requires thetype="module"
attribute on the script tags when loading. Because the compiled assets were loaded as regular JS, it caused aTypeError
when the script was executed.Unfortunately, WP only added
wp_enqueue_script_module
in 6.5 (this year), and adding thetype
attribute in earlier WP versions requires some filtering. Even when I tried adding the type attribute, I ran into other issues.The change to using modules requires far more QA than downgrading parcel at the moment, which is why this PR has chosen the latter. I suggest we circle back to upgrading parcel later when we have more time to dedicate to it.
QA