diff --git a/xmodule/util/builtin_assets.py b/xmodule/util/builtin_assets.py index 6b8eb86ecf34..cb1fca721414 100644 --- a/xmodule/util/builtin_assets.py +++ b/xmodule/util/builtin_assets.py @@ -5,6 +5,7 @@ """ from pathlib import Path +import webpack_loader from django.conf import settings from django.core.exceptions import ImproperlyConfigured @@ -43,11 +44,6 @@ def add_webpack_js_to_fragment(fragment, bundle_name): """ Add all JS webpack chunks to the supplied fragment. """ - # 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'): + for chunk in webpack_loader.utils.get_files(bundle_name, None, 'DEFAULT'): if chunk['name'].endswith(('.js', '.js.gz')): fragment.add_javascript_url(chunk['url'])