6

I recently upgraded a Django app to current Django and Python versions, and updated my pip packages as well. Now I'm getting this error:

Django Version:  3.2.3
Exception Type:  KeyError
Exception Value: 'assets'
Exception Location: /my/env1/lib/python3.8/site-packages/webpack_loader/loader.py, line 90, in get_bundle

Looking at the Exception Location, I see:

enter image description here

...and looking at assets, confirms it has no key named assets:

enter image description here

How do I fix this?

VikR
  • 4,818
  • 8
  • 51
  • 96

3 Answers3

9

Had the same issue today so I thought I would share my solution. According to the django-webpack-loader docs, you need to make sure that you are using webpack-bundle-tracker@1.0.0 on your Javascript side. You could downgrade to django-webpack-loader 0.7.0, but if your frontend bundle is large, you may be able to benefit from code splitting in the latest version. See this issue.

Theophylline
  • 193
  • 8
  • This is the correct answer. One has to make sure the versions on both django and the node ends are compatible. Note that `webpack-bundle-tracker@1.0.0` will also create a different bundle structure (usually only a 'main' chunk group in contrast to the 'main' 'runtime' and 'vendors' groups that versions <=0.7.0 will make) – superk Jun 08 '21 at 20:58
  • you saved my day! – Ron Jul 30 '21 at 06:41
7

I'm using Django 3.0.10. Downgrading django-webpack-loader from 1.0.0 to 0.7.0 stopped the error.

3

I had the same problem, try this solution its work for me.

uninstall webpack from frontend:

npm install --save-dev webpack-bundle-tracker

install webpack version:1.1.0 from frontend:

npm install --save-dev webpack-bundle-tracker@1.1.0

you good to go.

if this does not work you should check https://pypi.org/project/django-webpack-loader/

Reza Rahemtola
  • 1,182
  • 7
  • 16
  • 30