Skip to content

All my Stimulus controllers are unregistered, even though they aren't #144

@Burgestrand

Description

@Burgestrand

(this issue is written in tandem with @marcoroth at Baltic Ruby!)

Here's my application.js:

/* eslint no-console:0 */

import { Application } from "@hotwired/stimulus"
import { definitionsFromContext } from "@hotwired/stimulus-webpack-helpers"
import CheckboxSelectAll from "stimulus-checkbox-select-all"

const application = Application.start()

const context = require.context("./controllers", true, /.js/)
application.load(definitionsFromContext(context))

application.register("checkbox-select-all", CheckboxSelectAll)
image

The problem is that the Stimulus application and the control index file are in the same file? Or that the require.context doesn't expand properly.

We did separate this into controllers/application.js and controllers/index.js, but that didn't change the outcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions