You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But looks like things have change on rails 7, now on index.js I have something like this:
`import { application } from "controllers/application"
// Eager load all controllers defined in the import map under controllers/**/*_controller
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
I'm trying to use viewcomponents on a brand new rails 7 app, I have done this before in rails 6 using the hack that is on viewcomponents.org
`import { Application } from "stimulus"
import { definitionsFromContext } from "stimulus/webpack-helpers"
const application = Application.start()
const context = require.context("controllers", true, /.js$/)
const contextComponents = require.context("../../components", true, /_controller.js$/)
application.load(
definitionsFromContext(context).concat(
definitionsFromContext(contextComponents)
)
)`
But looks like things have change on rails 7, now on index.js I have something like this:
`import { application } from "controllers/application"
// Eager load all controllers defined in the import map under controllers/**/*_controller
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
eagerLoadControllersFrom("controllers", application)`
and I'm not sure how to implement the hack on this new format, do you know how I can workarround this problem?
The text was updated successfully, but these errors were encountered: