@@ -37,21 +37,22 @@ def get_assets(self):
37
37
return self ._assets [self .name ]
38
38
return self .load_assets ()
39
39
40
- def filter_chunks (self , chunks ):
40
+ def filter_chunks (self , chunks , files ):
41
41
for chunk in chunks :
42
- ignore = any (regex .match (chunk [ 'name' ] )
42
+ ignore = any (regex .match (chunk )
43
43
for regex in self .config ['ignores' ])
44
44
if not ignore :
45
- chunk [ ' url' ] = self .get_chunk_url (chunk )
46
- yield chunk
45
+ url = self .get_chunk_url (chunk , files )
46
+ yield { 'name' : chunk , 'url' : url }
47
47
48
- def get_chunk_url (self , chunk ):
49
- public_path = chunk .get ('publicPath' )
48
+ def get_chunk_url (self , chunk , files ):
49
+ chunk_file = files [chunk ]
50
+ public_path = chunk_file .get ('publicPath' )
50
51
if public_path :
51
52
return public_path
52
53
53
54
relpath = '{0}{1}' .format (
54
- self .config ['BUNDLE_DIR_NAME' ], chunk [ 'name' ]
55
+ self .config ['BUNDLE_DIR_NAME' ], chunk
55
56
)
56
57
return staticfiles_storage .url (relpath )
57
58
@@ -64,7 +65,7 @@ def get_bundle(self, bundle_name):
64
65
timeout = self .config ['TIMEOUT' ] or 0
65
66
timed_out = False
66
67
start = time .time ()
67
- while assets ['status' ] == 'compiling' and not timed_out :
68
+ while ( assets ['status' ] == 'compiling' or assets [ 'status' ] == 'compile' ) and not timed_out :
68
69
time .sleep (self .config ['POLL_INTERVAL' ])
69
70
if timeout and (time .time () - timeout > start ):
70
71
timed_out = True
@@ -80,7 +81,14 @@ def get_bundle(self, bundle_name):
80
81
chunks = assets ['chunks' ].get (bundle_name , None )
81
82
if chunks is None :
82
83
raise WebpackBundleLookupError ('Cannot resolve bundle {0}.' .format (bundle_name ))
83
- return self .filter_chunks (chunks )
84
+
85
+ for chunk in chunks :
86
+ asset = assets ['assets' ][chunk ]
87
+ if asset is None :
88
+ raise WebpackBundleLookupError ('Cannot resolve asset {0}.' .format (chunk ))
89
+
90
+ files = assets ['assets' ]
91
+ return self .filter_chunks (chunks , files )
84
92
85
93
elif assets .get ('status' ) == 'error' :
86
94
if 'file' not in assets :
0 commit comments