symfony / stimulus-bridge

Stimulus integration bridge for Symfony projects
https://symfony.com/ux
75 stars 15 forks source link

Your controllers.json file was not found. Be sure to add a Webpack alias from "@symfony/stimulus-bridge/controllers.json" to *your* controllers.json file. #77

Open dokselblackbit opened 1 year ago

dokselblackbit commented 1 year ago

Hello. I have some error: Your controllers.json file was not found. Be sure to add a Webpack alias from "@symfony/stimulus-bridge/controllers.json" to *your* controllers.json file. I added into webpack.config.js Encore.enableStimulusBridge('./assets/controllers.json') How to fix it?

controllers.json is into assets { "controllers": [], "entrypoints": [] }

weaverryan commented 1 year ago

Hi!

Hmm, I'm not sure! Encore.enableStimulusBridge('./assets/controllers.json') should be all you need. That creates a Webpack alias from @symfony/stimulus-bridge/controllers.json to ./assets/controllers.json, which this bridge then uses. I can't imagine what would be causing this to short-circuit. Is there anything special of custom about your set up or Webpack setup?

amavis442 commented 1 year ago

I do not know if this is still an issue, but https://github.com/symfony/stimulus-bridge/issues/30#issuecomment-776326465 solved it for me. I overwrote the alias and using Encore.addAliases({}) fixed it for me.

Oussama-lasri commented 2 months ago

add this - .enableStimulusBridge('./assets/controllers.json') - in webpack.config.js