How to fix “Support for the experimental syntax <OPERATOR>
isn’t currently enabled”
Problem ❓
I recently played around with the @primer/doctocat-template Gatbsy theme and encountered the following stack trace while building the repository.
It was originating from the @primer/gatsby-theme-doctocat package which was listed as a dependency in the @primer/doctocat-template
project.
Diagnosis ⛑
Upon inspection, I figured out that in the layout.js in the gatsby-theme-doctocat
, the developers have used the Logical Assignment
operator. Hence, the complaints from Babel.
Logical Assignment
seems to be a new proposal that requires an extra babel plugin called @babel/plugin-proposal-logical-assignment-operators
.
The stack trace was really helpful in this scenario since it clearly mentioned what should be done to fix the problem.