Uncaught TypeError: Class constructor Controller cannot be invoked without 'new'

Viewed 1261

I migrated from "stimulus": "^2.0.0" to "@hotwired/stimulus": "^3.0.0"

I got an error Uncaught TypeError: Class constructor Controller cannot be invoked without 'new' at new _default (message_list_controller.js:1)

I'm not sure what's wrong with message_list_controller.js I just changed from import { Controller } from "stimulus" to import { Controller } from "@hotwired/stimulus"

import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
    connect() {
        this.scrollToBottom()
    }

    scrollToBottom() {
        this.element.scrollTop = this.element.scrollHeight
    }
}

Can anyone advise how can I fix this

0 Answers
Related