I was able to fix the problem by converting the ES6 syntax to ES2015 and --minify didn’t mess with the code and everything works as expected.
Note: I didn’t run into this error until I built for production, because I wasn’t using minify when using hugo server.
I was using code similar to what is shown in the <script> element of this Alpine.js V3 example. data — Alpine.js