-
Notifications
You must be signed in to change notification settings - Fork 342
Closed
Description
We have a legacy Django-webpack app using Django webpack loader. The app code moved into a /app directory and the render_bundle stopped working. The error message is
File "/usr/local/lib/python3.9/site-packages/webpack_loader/templatetags/webpack_loader.py", line 22, in render_bundle
tags = utils.get_as_tags(
File "/usr/local/lib/python3.9/site-packages/webpack_loader/utils.py", line 71, in get_as_tags
bundle = _get_bundle(loader, bundle_name, extension)
File "/usr/local/lib/python3.9/site-packages/webpack_loader/utils.py", line 47, in _get_bundle
bundle = loader.get_bundle(bundle_name)
File "/usr/local/lib/python3.9/site-packages/webpack_loader/loader.py", line 116, in get_bundle
filtered_chunks = self.filter_chunks(chunks)
File "/usr/local/lib/python3.9/site-packages/webpack_loader/loader.py", line 58, in filter_chunks
ignore = any(regex.match(chunk)
File "/usr/local/lib/python3.9/site-packages/webpack_loader/loader.py", line 58, in <genexpr>
ignore = any(regex.match(chunk)
TypeError: expected string or bytes-like object
Versions:
django-webpack-loader: 1.6.0
webpack-bundle-tracker: 0.4.3
webpack-stats.json
{"status":"done","publicPath":"http://localhost:8001/","chunks":{"app":[{"name":"app.js","publicPath":"http://localhost:8001/app.js","path":"/app/static/dist/app.js"}]}}
I hard-coded our STATICS_URL to try to match the documentation on django-webpack-loader
STATIC_URL: /app/static/dist/
WEBPACK PATH(output.path): /app/static/dist
Code that triggers the error:
{% render_bundle 'app' %} inside a index.html
WEBPACK_LOADER:
BASE_DIR = "/app"
STATIC_URL = "/app/static/dist/"
STATIC_ROOT = Path(BASE_DIR, "public")
STATICFILES_DIRS = [
Path(BASE_DIR, "static"),
Path(BASE_DIR, "static", "dist"),
]
WEBPACK_LOADER = {"DEFAULT": {"CACHE": not DEBUG}}
Metadata
Metadata
Assignees
Labels
No labels