Symfony 6.4: Bazinga JS Translation Files Not Found in Production

I recently upgraded my Symfony application from version 5.4 to 6.4. My project uses Webpack Encore and the BazingaJsTranslationBundle to manage translations in JavaScript. In my Twig templates, I load translation files like this:

<script src="{{ path('bazinga_jstranslation_js', { 'domain': 'api' }) }}"></script>`

This works perfectly in all environments except for production (APP_ENV=prod). When APP_ENV is set to prod, the JavaScript translation files are not found, and the request to the bazinga_jstranslation_js route results in a 404 error. Everything works as expected when APP_ENV is set to anything else, such as dev, test, or prod2.

Here are some details about my setup:

  • Symfony version: 6.4
  • willdurand/js-translation-bundle version: 6.1
  • bazinga-translator version: 6.1
  • Webpack Encore for asset management.