File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 55"""
66from pathlib import Path
77
8- import webpack_loader
98from django .conf import settings
109from 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' ])
You can’t perform that action at this time.
0 commit comments