@@ -54,6 +54,8 @@ class DjangoViteConfig(NamedTuple):
5454 # The DjangoViteAppClient class to use to parse the manifest and load assets.
5555 app_client_class : str = "django_vite.core.asset_loader.DjangoViteAppClient"
5656
57+ cache_manifest : bool = True
58+
5759
5860class ManifestEntry (NamedTuple ):
5961 """
@@ -215,6 +217,18 @@ def get(self, path: str) -> ManifestEntry:
215217
216218 return self ._entries [path ]
217219
220+ def reload_manifest (self ) -> None :
221+ """
222+ Reload the manifest file and update internal state.
223+
224+ This method rereads the manifest.json file and updates the internal
225+ entries and legacy_polyfills_entry attributes with the fresh data.
226+ """
227+ if not self .dev_mode :
228+ parsed_output = self ._parse_manifest ()
229+ self ._entries = parsed_output .entries
230+ self .legacy_polyfills_entry = parsed_output .legacy_polyfills_entry
231+
218232
219233class DjangoViteAppClient :
220234 """
@@ -237,6 +251,7 @@ def __init__(
237251 self .static_url_prefix = config .static_url_prefix
238252 self .ws_client_url = config .ws_client_url
239253 self .react_refresh_url = config .react_refresh_url
254+ self .cache_manifest = config .cache_manifest
240255
241256 self .manifest = self .ManifestClient (config , app_name )
242257
@@ -321,6 +336,10 @@ def generate_vite_asset(
321336 )
322337
323338 tags : List [Tag ] = []
339+
340+ if not self .cache_manifest :
341+ self .manifest .reload_manifest ()
342+
324343 manifest_entry = self .manifest .get (path )
325344 scripts_attrs = {"type" : "module" , "crossorigin" : "" , ** kwargs }
326345
0 commit comments