⁨3⁩ ⁨Comments⁩

Answer
Toby Toby Waterhole Founder Jun 21, 2023

Hi @mtdmy, you'll need to:

  1. Create a new Stimulus controller at resources/js/controllers/hello_controller.js, and then register it with Waterhole's Stimulus instance in resources/js/app.js:
import HelloController from './controllers/hello_controller';

window.Stimulus.register('hello', HelloController);
  1. Set up a JavaScript compilation step - probably the easiest way is to use Laravel Mix. Output your compiled JavaScript to resources/dist/app.js.

  2. Add this script to Waterhole's JavaScript bundle in your service provider:

Extend\Script::add(resource_path('dist/app.js'));

Hopefully that's enough to get you started – let me know if you have any specific questions.

In reply to Toby Toby

Hello Toby,

Recently, I've been working on some demos, but I've run into some issues with organizing my frontend configuration. Specifically, I'm wondering how I can manage files like package.json, tsconfig, and webpack.mix.js.

Would you happen to have any advice or a demo you could share with me? I've already checked out the Waterhole extension template, but unfortunately, I didn't find what I was looking for there.

Thank you for your help!