Now, all my controllers generates the console error Unhandled Promise Rejection: TypeError: Cannot call a class constructor without |new|. On line 2, which is a blank line. Even with an empty controller, like this:
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
}
It generates that error in both Safari and Chrome, but if I remove the class declaration the error isn’t thrown. I’m tearing what little of my hair is left out.
I event trying without @hotwired/stimulus-webpack-helpers and manually load the controller but I have always the same error. I feel I’m missing some steps on my application.js. Here are my relevant lines:
I upgraded my use of stimulus-use to point to the beta branch and everything works just fine! Perhaps create a PR for @excid3 (I know the guy is uber busy with all his open-source contributions and projects).
Are you stating that you’re using stimulus-use and not stimulus, from what I’ve understood and my experience, this error happens with the version 3.0.0.. I haven’t tried with yesterday’s 3.0.1 release yet.