Skip to content

Commit d84f7c5

Browse files
committed
Reapply "fix: intermittent "utils attribute not found" issue in webpack_loader (openedx#37306)" (#314)
This reverts commit 37a438c.
1 parent 37a438c commit d84f7c5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

xmodule/util/builtin_assets.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66
from pathlib import Path
77

8-
import webpack_loader
98
from django.conf import settings
109
from django.core.exceptions import ImproperlyConfigured
1110

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

0 commit comments

Comments
 (0)