DEV Community

Discussion on: Django + webpack + Vue.js: setting up a new project that’s easy to develop and deploy (part 1)

Collapse
 
vmihalachi profile image
Vlad Mihalachi

Hi Alejandro, I wanted to thank you for your post, it was indeed very useful.

When running in production I get this error: "webpackJsonp is not defined".
I assume that's normal since you posted only the first part.

Will you publish the second one?

Again, thank you!

Collapse
 
zerkz profile image
Zack Whipkey

Usually whenever I got that, it's because you are using multiple bundles/chunks that might not be imported in the correct order.

Collapse
 
vmihalachi profile image
Vlad Mihalachi • Edited

Yep, adding something like that solved the problem :)
gist.github.com/vmihalachi/7bceb1a...

Thread Thread
 
ariera profile image
Alejandro Riera

Hey Vlad,

yes, that's exactly the solution. In my case I ended up creating a context_processor called env, like this:

from django.conf import settings

def env(request):
    return {'env': settings.ENVIRONMENT}

That allows me to check agains the environment instead of DEBUG in my templates, ie:

{% if env == 'production' %}
  {% render_bundle 'manifest' %}
  {% render_bundle 'vendor' %}
{% endif %}
{% render_bundle 'app' %}

I'll treat this and a few more issue in the second part :)

Thread Thread
 
vmihalachi profile image
Vlad Mihalachi

Thanks man, you are great!