Django Webpack Loader: "Assets" KeyError?

Viewed 1068

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?

3 Answers

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

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.

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/

Related