Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions xmodule/util/builtin_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"""
from pathlib import Path

import webpack_loader
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. It sounds to me like this module was treating utils as an attribute of webpack_loader, but it's actually a sub-module. So, when webpack_loader.utils happened to be imported, the code worked, but when it wasn't imported, we got an AttributeError.

Does your fix still work if you put from webpack_loader.utils import get_files at the top of the module instead of within the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried importing it at the top of the file, but it resulted in this error:

Traceback (most recent call last):
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 25, in load_assets
2025-08-09 12:59:08     with open(self.config['STATS_FILE'], encoding="utf-8") as f:
2025-08-09 12:59:08          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08 FileNotFoundError: [Errno 2] No such file or directory: 'webpack-stats.json'
2025-08-09 12:59:08 
2025-08-09 12:59:08 During handling of the above exception, another exception occurred:
2025-08-09 12:59:08 
2025-08-09 12:59:08 Traceback (most recent call last):
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
2025-08-09 12:59:08     response = get_response(request)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
2025-08-09 12:59:08     response = wrapped_callback(request, *callback_args, **callback_kwargs)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/views/decorators/http.py", line 43, in inner
2025-08-09 12:59:08     return func(request, *args, **kwargs)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/common/djangoapps/util/views.py", line 63, in inner
2025-08-09 12:59:08     response = view_func(request, *args, **kwargs)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/views/decorators/clickjacking.py", line 58, in wrapper_view
2025-08-09 12:59:08     resp = view_func(*args, **kwargs)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
2025-08-09 12:59:08     response = view_func(request, *args, **kwargs)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/lms/djangoapps/courseware/views/views.py", line 1734, in render_xblock
2025-08-09 12:59:08     fragment = block.render(requested_view, context=student_view_context)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/core.py", line 818, in render
2025-08-09 12:59:08     return self.runtime.render(self, view, context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/x_module.py", line 997, in render
2025-08-09 12:59:08     return super().render(block, view_name, context=context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/runtime.py", line 823, in render
2025-08-09 12:59:08     frag = view_fn(context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/vertical_block.py", line 204, in student_view
2025-08-09 12:59:08     return self._student_or_public_view(context, STUDENT_VIEW)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/vertical_block.py", line 131, in _student_or_public_view
2025-08-09 12:59:08     rendered_child = child.render(view, child_block_context)
2025-08-09 12:59:08                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/core.py", line 818, in render
2025-08-09 12:59:08     return self.runtime.render(self, view, context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/x_module.py", line 997, in render
2025-08-09 12:59:08     return super().render(block, view_name, context=context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/runtime.py", line 823, in render
2025-08-09 12:59:08     frag = view_fn(context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/capa_block.py", line 371, in student_view
2025-08-09 12:59:08     add_webpack_js_to_fragment(fragment, 'ProblemBlockDisplay')
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/util/builtin_assets.py", line 46, in add_webpack_js_to_fragment
2025-08-09 12:59:08     for chunk in get_files(bundle_name, None, 'DEFAULT'):
2025-08-09 12:59:08                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/utils.py", line 48, in get_files
2025-08-09 12:59:08     return list(_get_bundle(bundle_name, extension, config))
2025-08-09 12:59:08                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/utils.py", line 40, in _get_bundle
2025-08-09 12:59:08     bundle = get_loader(config).get_bundle(bundle_name)
2025-08-09 12:59:08              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 59, in get_bundle
2025-08-09 12:59:08     assets = self.get_assets()
2025-08-09 12:59:08              ^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 36, in get_assets
2025-08-09 12:59:08     self._assets[self.name] = self.load_assets()
2025-08-09 12:59:08                               ^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 28, in load_assets
2025-08-09 12:59:08     raise IOError(
2025-08-09 12:59:08 OSError: Error reading webpack-stats.json. Are you sure webpack has generated the file and the path is correct?
2025-08-09 12:59:08 [09/Aug/2025 07:59:08] "GET /api/edx_proctoring/v1/proctored_exam/attempt/course_id/course-v1:UAI_SOURCE+CS11011+2019_t5?content_id=block-v1%3AUAI_SOURCE%2BCS11011%2B2019_t5%2Btype%40sequential%2Bblock%4038765304751447e7ba386b5cfd942df0&is_learning_mfe=true HTTP/1.1" 200 31
2025-08-09 12:59:08 Internal Server Error: /xblock/block-v1:UAI_SOURCE+CS11011+2019_t5+type@vertical+block@ddb6631cb1d44f19aae97df9cf78f683
2025-08-09 12:59:08 Traceback (most recent call last):
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 25, in load_assets
2025-08-09 12:59:08     with open(self.config['STATS_FILE'], encoding="utf-8") as f:
2025-08-09 12:59:08          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08 FileNotFoundError: [Errno 2] No such file or directory: 'webpack-stats.json'
2025-08-09 12:59:08 
2025-08-09 12:59:08 During handling of the above exception, another exception occurred:
2025-08-09 12:59:08 
2025-08-09 12:59:08 Traceback (most recent call last):
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
2025-08-09 12:59:08     response = get_response(request)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
2025-08-09 12:59:08     response = wrapped_callback(request, *callback_args, **callback_kwargs)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/views/decorators/http.py", line 43, in inner
2025-08-09 12:59:08     return func(request, *args, **kwargs)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/common/djangoapps/util/views.py", line 63, in inner
2025-08-09 12:59:08     response = view_func(request, *args, **kwargs)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/views/decorators/clickjacking.py", line 58, in wrapper_view
2025-08-09 12:59:08     resp = view_func(*args, **kwargs)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
2025-08-09 12:59:08     response = view_func(request, *args, **kwargs)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/lms/djangoapps/courseware/views/views.py", line 1734, in render_xblock
2025-08-09 12:59:08     fragment = block.render(requested_view, context=student_view_context)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/core.py", line 818, in render
2025-08-09 12:59:08     return self.runtime.render(self, view, context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/x_module.py", line 997, in render
2025-08-09 12:59:08     return super().render(block, view_name, context=context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/runtime.py", line 823, in render
2025-08-09 12:59:08     frag = view_fn(context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/vertical_block.py", line 204, in student_view
2025-08-09 12:59:08     return self._student_or_public_view(context, STUDENT_VIEW)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/vertical_block.py", line 131, in _student_or_public_view
2025-08-09 12:59:08     rendered_child = child.render(view, child_block_context)
2025-08-09 12:59:08                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/core.py", line 818, in render
2025-08-09 12:59:08     return self.runtime.render(self, view, context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/x_module.py", line 997, in render
2025-08-09 12:59:08     return super().render(block, view_name, context=context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/runtime.py", line 823, in render
2025-08-09 12:59:08     frag = view_fn(context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/capa_block.py", line 371, in student_view
2025-08-09 12:59:08     add_webpack_js_to_fragment(fragment, 'ProblemBlockDisplay')
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/util/builtin_assets.py", line 46, in add_webpack_js_to_fragment
2025-08-09 12:59:08     for chunk in get_files(bundle_name, None, 'DEFAULT'):
2025-08-09 12:59:08                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/utils.py", line 48, in get_files
2025-08-09 12:59:08     return list(_get_bundle(bundle_name, extension, config))
2025-08-09 12:59:08                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/utils.py", line 40, in _get_bundle
2025-08-09 12:59:08     bundle = get_loader(config).get_bundle(bundle_name)
2025-08-09 12:59:08              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 59, in get_bundle
2025-08-09 12:59:08     assets = self.get_assets()
2025-08-09 12:59:08              ^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 36, in get_assets
2025-08-09 12:59:08     self._assets[self.name] = self.load_assets()
2025-08-09 12:59:08                               ^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 28, in load_assets
2025-08-09 12:59:08     raise IOError(
2025-08-09 12:59:08 OSError: Error reading webpack-stats.json. Are you sure webpack has generated the file and the path is correct?
2025-08-09 12:59:08 2025-08-09 07:59:08,591 ERROR 309 [django.request] [user None] [ip None] log.py:246 - Internal Server Error: /xblock/block-v1:UAI_SOURCE+CS11011+2019_t5+type@vertical+block@ddb6631cb1d44f19aae97df9cf78f683
2025-08-09 12:59:08 Traceback (most recent call last):
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 25, in load_assets
2025-08-09 12:59:08     with open(self.config['STATS_FILE'], encoding="utf-8") as f:
2025-08-09 12:59:08          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08 FileNotFoundError: [Errno 2] No such file or directory: 'webpack-stats.json'
2025-08-09 12:59:08 
2025-08-09 12:59:08 During handling of the above exception, another exception occurred:
2025-08-09 12:59:08 
2025-08-09 12:59:08 Traceback (most recent call last):
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
2025-08-09 12:59:08     response = get_response(request)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
2025-08-09 12:59:08     response = wrapped_callback(request, *callback_args, **callback_kwargs)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/views/decorators/http.py", line 43, in inner
2025-08-09 12:59:08     return func(request, *args, **kwargs)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/common/djangoapps/util/views.py", line 63, in inner
2025-08-09 12:59:08     response = view_func(request, *args, **kwargs)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/views/decorators/clickjacking.py", line 58, in wrapper_view
2025-08-09 12:59:08     resp = view_func(*args, **kwargs)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
2025-08-09 12:59:08     response = view_func(request, *args, **kwargs)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/lms/djangoapps/courseware/views/views.py", line 1734, in render_xblock
2025-08-09 12:59:08     fragment = block.render(requested_view, context=student_view_context)
2025-08-09 12:59:08                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/core.py", line 818, in render
2025-08-09 12:59:08     return self.runtime.render(self, view, context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/x_module.py", line 997, in render
2025-08-09 12:59:08     return super().render(block, view_name, context=context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/runtime.py", line 823, in render
2025-08-09 12:59:08     frag = view_fn(context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/vertical_block.py", line 204, in student_view
2025-08-09 12:59:08     return self._student_or_public_view(context, STUDENT_VIEW)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/vertical_block.py", line 131, in _student_or_public_view
2025-08-09 12:59:08     rendered_child = child.render(view, child_block_context)
2025-08-09 12:59:08                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/core.py", line 818, in render
2025-08-09 12:59:08     return self.runtime.render(self, view, context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/x_module.py", line 997, in render
2025-08-09 12:59:08     return super().render(block, view_name, context=context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/xblock/runtime.py", line 823, in render
2025-08-09 12:59:08     frag = view_fn(context)
2025-08-09 12:59:08            ^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/capa_block.py", line 371, in student_view
2025-08-09 12:59:08     add_webpack_js_to_fragment(fragment, 'ProblemBlockDisplay')
2025-08-09 12:59:08   File "/openedx/edx-platform/xmodule/util/builtin_assets.py", line 46, in add_webpack_js_to_fragment
2025-08-09 12:59:08     for chunk in get_files(bundle_name, None, 'DEFAULT'):
2025-08-09 12:59:08                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/utils.py", line 48, in get_files
2025-08-09 12:59:08     return list(_get_bundle(bundle_name, extension, config))
2025-08-09 12:59:08                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/utils.py", line 40, in _get_bundle
2025-08-09 12:59:08     bundle = get_loader(config).get_bundle(bundle_name)
2025-08-09 12:59:08              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 59, in get_bundle
2025-08-09 12:59:08     assets = self.get_assets()
2025-08-09 12:59:08              ^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 36, in get_assets
2025-08-09 12:59:08     self._assets[self.name] = self.load_assets()
2025-08-09 12:59:08                               ^^^^^^^^^^^^^^^^^^
2025-08-09 12:59:08   File "/openedx/venv/lib/python3.11/site-packages/webpack_loader/loader.py", line 28, in load_assets
2025-08-09 12:59:08     raise IOError(
2025-08-09 12:59:08 OSError: Error reading webpack-stats.json. Are you sure webpack has generated the file and the path is correct?

from django.conf import settings
from django.core.exceptions import ImproperlyConfigured

Expand Down Expand Up @@ -44,6 +43,11 @@ def add_webpack_js_to_fragment(fragment, bundle_name):
"""
Add all JS webpack chunks to the supplied fragment.
"""
for chunk in webpack_loader.utils.get_files(bundle_name, None, 'DEFAULT'):
# Importing webpack_loader.utils at the top of the module causes an exception:
# OSError: Error reading webpack-stats.json.
# Are you sure webpack has generated the file and the path is correct?
# We are not quite sure why.
from webpack_loader.utils import get_files
for chunk in get_files(bundle_name, None, 'DEFAULT'):
if chunk['name'].endswith(('.js', '.js.gz')):
fragment.add_javascript_url(chunk['url'])
Loading