After developing 4 LWC components then deploying to a scratch org via
SFDX: Push Source to Default Scratch Org, the Salesforce CLI returns:
LWC1001: Unexpected compilation error: did not find a shallow_cmp function for AST_Chain
- All 4 LWCs do not throw errors when deployed to Local Development Server
- 1 LWC is a service component
- 2 LWC components are child components
- Running sfdx-cli/7.98.0
- Each LWC is running API version 51.0
- All are visible for each, except for service LWC
- All targets are declared for each, except for service LWC
What I have tried:
- Transfering LWCs to a new project and deploying them.
- Deploying each LWC individually.
- Updating sfdx
- Deploying from a new project and updating sfdx still returns the same error.
- But, after deploying each LWC individually, I discovered two of them cannot deploy by themselves. One of them, let's call it
c-bar, cannot deploy because it references
c-fooin its markup. However, when deploying just
c-foothe CLI returns the same error--
LWC1001: Unexpected compilation error: did not find a shallow_cmp function for AST_Chain--and VS Code points to its
foo.js-meta.xmlfile. Therefore, presumably,
c-foois the cause so I commented both
foo.jsfiles, as well as the
c-fooreference in the
bar.htmlmarkup then re-deployed
c-foo. As a result, it was able to successfully deploy.
- When commenting just its markup file (
foo.html), leaving it just
<template></template>, the CLI returns the same compilation error which leaves me to think the
foo.jsis the cause for some reason.
Any thoughts or suggestions why a compilation error can occur from
foo.js, when all it mainly does is listening for and dispatching events?