Skip to content

Commit 09ea1c7

Browse files
committed
Do not rely on present INTEGRITY key in config
1 parent cb9b19e commit 09ea1c7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

webpack_loader/loader.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ def get_assets(self):
3939
return self.load_assets()
4040

4141
def get_integrity_attr(self, chunk):
42-
if not self.config['INTEGRITY']:
42+
if not self.config.get('INTEGRITY'):
4343
return ''
4444

4545
integrity = chunk.get('integrity')
4646
if not integrity:
4747
raise WebpackLoaderBadStatsError(
4848
"The stats file does not contain valid data: INTEGRITY is set to True, "
49-
"but chunk does not contain \"integrity\" key.")
49+
"but chunk does not contain \"integrity\" key. Maybe you forgot to add "
50+
"integrity: true in your BundleTracker configuration?")
5051

5152
return ' integrity="{}" '.format(integrity.partition(' ')[0])
5253

@@ -65,7 +66,7 @@ def map_chunk_files_to_url(self, chunks):
6566
assets = self.get_assets()
6667
files = assets['assets']
6768

68-
add_integrity = self.config['INTEGRITY']
69+
add_integrity = self.config.get('INTEGRITY')
6970

7071
for chunk in chunks:
7172
url = self.get_chunk_url(files[chunk])

0 commit comments

Comments
 (0)