Thorsten Claus

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

I want to extend the Stimulus controller to get some often used method in one place, like this:
import {Controller} from "@hotwired/stimulus"

./controllers/base.js
export default class Base extends Controller {
defineSettings() {...}
}

Then I want to use this 'base' in my inherited controller, like a normal controller:

./controllers/stream_controller.js
import Base from "./base.js"

export default class extends Base {
initialized() {...}

}

On my dev machine this works (after assets:precompile) but in production mode the 'base' class is not found:
"Error: Unable to resolve specifier 'base' imported from stream_controller..."

I am totally unsure if this possible and how to "correct" set my imports.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.