0

I'm having problem with Symfony webpack encore and getting following error.

Loading failed for the <script> with source “http://localhost:8000/build/js/app.js”.

Tried with both with or without asset.

 <script src="{{ asset('build/js/app.js') }}"></script>

Tried with Firefox, Chrome.

2 Answers 2

1

Ok I figure out what was the problem,

I was doing following code

{% block javascripts %}
      {{ encore_entry_script_tags('app') }}
      <script src="{{ asset('build/js/app.js') }}"></script>
{% endblock %}

inside the base.html.twig, but later when I moved to template where it was extended then it worked.

Sign up to request clarification or add additional context in comments.

1 Comment

i don't think you need to include <script src="{{ asset('build/js/app.js') }}"></script> as this is already being included in {{ encore_entry_script_tags('app') }}
0

Did you also tried to use it like this?

{% block javascripts %}
    {{ encore_entry_script_tags('app') }}
{% endblock %}

1 Comment

Thanks man it worked the mistake was I was doing inside base template and I missed {{ encore_entry_script_tags('app') }} to write.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.