wire-elements / spotlight

Livewire component that brings Spotlight/Alfred-like functionality to your Laravel application.
MIT License
911 stars 71 forks source link

Alpine JS class error in 7.4 #14

Closed afiqiqmal closed 3 years ago

afiqiqmal commented 3 years ago

I received this error,

alpine.js:144 Uncaught SyntaxError: Unexpected token 'class'
    at new Function (<anonymous>)
    at d.el (alpine.js:144)
    at d (alpine.js:131)
    at f (alpine.js:139)
    at be.evaluateReturnExpression (alpine.js:1754)
    at alpine.js:1730
    at Array.forEach (<anonymous>)
    at be.resolveBoundAttributes (alpine.js:1703)
    at be.initializeElement (alpine.js:1628)
    at alpine.js:1612

I'm using tag "dev-php-7.4-support"

How to solve this?

PhiloNL commented 3 years ago

Hi @afiqiqmal, Which version of Alpine are you using? And how are you loading Alpine (via NPM or CDN) and are you loading Alpine before/after Livewire? Some more code would help as well.

afiqiqmal commented 3 years ago

Im using webpack as alpine is placed in app.js

require('./bootstrap');
import 'alpinejs';

as in blade file

....
@livewireScripts

{{ Html::script('assets/app.js') }}

@livewire('livewire-ui-spotlight')

I also tried to load using CDN https://raw.githubusercontent.com/alpinejs/alpine/master/dist/alpine.js

Also give same error message

alpine.js:144 Uncaught SyntaxError: Unexpected token 'class'
afiqiqmal commented 3 years ago

Found the issue.

This package "https://github.com/renatomarinho/laravel-page-speed" cause the error.

Screenshot 2021-04-26 at 3 25 32 AM

If existing tailwind using prefix, then the spotlight would not working