You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So my way around this was to add a configuration of public_folder_passthrough. I don't know a better name or if this is even the correct path, but I updated the ManifestClient.get() method to make a pass through entry if it fails to find it in the manifest.json.
if path not in self._entries:
if self._config.public_folder_passthrough:
return ManifestEntry(
file=path,
src=path,
isEntry=True,
)
else:
raise DjangoViteAssetNotFoundError(
f"Cannot find {path} for app={self.app_name} in Vite manifest at "
f"{self.manifest_path}"
)
I am not sure if there is a better way, but this works exactly as expected once I added the passthrough for the public assets
The text was updated successfully, but these errors were encountered:
I bypass this problem by adding both the dist and public folders in STATICFILES_DIRS. In my templates, I always reference the files that are in public using the static tag rather than using the vite_asset_url tag. Naturally, if Django-Vite managed the files correctly in a public directory, it would be great. This would avoid asymmetry between the files associated with the frontend.
However, this has the advantage of being a simple solution that does not involve any direct modification of Django-Vite. Maybe I'm missing, however, a border effect that is likely to pose a problem.
So there is a public folder option in vite build that does not create any entries, but you can still reference entries off of the root. https://vitejs.dev/guide/assets#the-public-directory
In my template I still want to reference these items by using the
vite_asset_url
function.So my way around this was to add a configuration of
public_folder_passthrough
. I don't know a better name or if this is even the correct path, but I updated theManifestClient.get()
method to make a pass through entry if it fails to find it in the manifest.json.I am not sure if there is a better way, but this works exactly as expected once I added the passthrough for the public assets
The text was updated successfully, but these errors were encountered: