New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with staticfiles collection and missing source map files #4045
Comments
Thanks for the detailed bug report and suggested fix. That's a bit weird, I don't remember seeing an error like this before... Do you remember which options you have selected when generating? I see frontend_pipeline=Gulp, docker=n, whitenoise=y and Cloud provider=Azure. I think the error is specific to Gulp + Whitenoise? |
Here's my configuration - it does use Gulp + Whitenoise, yep. I would think it would happen without Gulp too, if Whitenoise tries to server popper.js, but maybe not, still a little fuzzy on static asset compilation. The strange thing is how it happens in my prod environment and not locally. I'd expect it to always happen in Django 4.1 (based on the django ticket), so if I have time today I'll see if I can upgrade and replicate it locally.
|
In production, the file My workaround was by adding |
I don't believe the default UI uses it, but it would be needed if the website actually utilized one of the Bootstrap JS widgets that rely on popper, so it would become an issue at that point. |
Update: I was able to replicate this on my local server (keeping Django 4.0.8) by copying the production setting to settings/local:
|
What happened?
When I ran
collectstatic
on my production server, I get this error:The error comes because popper.js has this comment:
But popper.min.js.map is not copied into the static files directory.
This general issue is reported as an issue in Django 4.1:
https://code.djangoproject.com/ticket/33353#comment:15
And there was a fix to django-rest-framework to add source map files:
encode/django-rest-framework#8591
I am not sure why I am seeing this in Django 4.0.8, since it's supposedly a 4.1 issue, but perhaps 4.0.8 manifests an earlier version of the issue.
Proposed fix
This is the change I made to my repo:
pamelafox/cookiecutter-django-output@c5e8166
I modified the gulpfile to copy over the *.map files for the vendor files, and add *.map to the gitignore file.
I can submit that as a pull request to this repository if it seems like a helpful change.
Additional details
This is the repository I deployed:
https://github.com/pamelafox/cookiecutter-django-output/tree/961a1ebfd226ec1aa0726760e4c2fd46b7bc0840
I deployed using the 'azd up' command to Azure App Service (using infrastructure files I wrote myself), and I found the error in the deployment center logs.
I do not seem to get the error when I run
manage.py collectstatic
locally.The text was updated successfully, but these errors were encountered: