headstartwp icon indicating copy to clipboard operation
headstartwp copied to clipboard

Dual Package Hazard

Open nicholasio opened this issue 1 year ago • 0 comments

Describe the bug

Currently, HeadstartWP ships both a CJS export and an ESM export. This allows modern consumers to include less code and to support ESM ecosystem.

However, we're currently suffering from "Dual Package Hazard" which means there might be instances of "instance of" check that simply do not work well. For instance isBlockByName might always return false given the instanceof check regardless of the matching node.

This is not the first symptom of this issue - we've also had issues where the SWRConfig cache wasn't working at all which has been fixed but other issues like this will likely keep happening.

This issue is to explore our options and how to address this issue for real.

See https://nodejs.org/api/packages.html#dual-package-hazard for more info.

Steps to Reproduce

See https://github.com/GeoffreyBooth/dual-package-hazard#dual-package-hazard

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

nicholasio avatar Jun 14 '23 01:06 nicholasio