Hey there!
I have a pretty basic rails + webpacker app, 100% following webpacker tutorial. When i’m trying to load an external controller (following this example) which looks like this:
import { Controller } from "stimulus"
export default class extends Controller {
static targets = [ "toggleBtn", "moreFilters" ]
toggleMoreFilters (e) {
e.preventDefault()
this.moreFiltersTarget.classList.toggle('d-none')
}
submitForm (e) {
if (e.key == 'Enter') {
this.element.submit()
}
}
}
webpacker throws:
ERROR in ./node_modules/@beehivecms/core/frontend/controllers/search_form_controller.js
Module parse failed: Unexpected token (4:17)
You may need an appropriate loader to handle this file type.
|
| export default class extends Controller {
| static targets = [ "toggleBtn", "moreFilters" ]
|
| toggleMoreFilters (e) {
@ ./app/javascript/packs/beehive_admin.js 13:0-100
@ multi (webpack)-dev-server/client?http://localhost:3035 ./app/javascript/packs/beehive_admin.js
webpack: Failed to compile.
Is there anything obvious i forgot to do in order to be able to include an external controller manually?
Thanks in advance!