Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

static declarations raising an error on safari #366

Closed
leonardoprg opened this issue Jan 13, 2021 · 3 comments
Closed

static declarations raising an error on safari #366

leonardoprg opened this issue Jan 13, 2021 · 3 comments

Comments

@leonardoprg
Copy link

Hello guys,

Im using stimulus 2 with rails pipeline.
All works good except when opening the site on safari (im using safari 14.0.2 on mac and it happens on iphone as well)
which raises an warning Failed to autoload controller: ...

Investigating it a bit discovered that the message error is:
Unexpected token '='. Expected an opening '(' before a method's parameter list
which is related to the declaration of the target

static targets = [ "addressInput" ]

removing this line it works well.

any idea how to get it working on safari?

Thanks

@npezza93
Copy link

In Safari, you can rewrite to:

static get targets() {
  return [ "addressInput" ]
}

@rik
Copy link
Contributor

rik commented Jan 16, 2021

More details are available in the Installation part of the handbook.

@leonardoprg
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants