From a1dff0e6a2213ac5303e7a91105c652cb641d5a0 Mon Sep 17 00:00:00 2001 From: luki009 Date: Sat, 6 Dec 2025 14:01:41 +0100 Subject: [PATCH] Add warning for default timeout in webpack_loader Added warning for potential indefinite loading due to default timeout. --- webpack_loader/loaders.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/webpack_loader/loaders.py b/webpack_loader/loaders.py index 2fde9310..268d52d0 100644 --- a/webpack_loader/loaders.py +++ b/webpack_loader/loaders.py @@ -35,7 +35,11 @@ 'django_webpack_loader can\'t generate a nonce tag for a bundle, ' 'because the passed request doesn\'t contain a "csp_nonce". ' 'Chunk name: {chunk_name}') - +_LOADER_POSSIBLE_LIMBO = ( + 'You are using django_webpack_loader with default timeout "None" ' + 'which can cause request to hang indefinitely. ' + 'Validate status of webpack-stats.json file if you experience infinite loading.' +) @lru_cache(maxsize=100) def _get_netloc(url: str) -> str: @@ -187,6 +191,10 @@ def get_bundle(self, bundle_name): time.sleep(self.config["POLL_INTERVAL"]) if timeout and (time.time() - timeout > start): timed_out = True + if not timeout: + warn( + message=_LOADER_POSSIBLE_LIMBO, category=RuntimeWarning + ) assets = self.get_assets() if timed_out: