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
If a Vite resource file is not found a ViteException exception is thrown. This makes sense since you need all resources available to make you application work.
However there is one exception (I know of), if you have resources linked to a language.
If languages are switched and a translation is not found the framework will return the string in the default language. If the file name of a resource contains the language and it is not found it would make sense to be able to return something default.
Since there is no requirement to order your resources using a language the same fallback method as available in Translator would help to resolve this issue.
My idea is to set a missing manifest files handler in one of the applications providers using a single call: Vite::handleMissingManifestFilesUsing([$this, 'getMissingManifestFile'])
The handler itself could check if check if the resource is related to the language and return the image of the default language:
publicfunctiongetMissingManifestFile($file)
{
if (str_starts_with($file, 'resources/images/header-')) {
return'resources/images/header-'.config('app.default_locale').'.svg';
}
returnnull;
}
The handler itself will check if the file can be found in the manifest, if not the ViteException Exception will be thrown. Also if no handler is registered the ViteException is thrown.
Also a function to check if a file exists in the manifest file can be helpful if the strings of the resources would be generated by a function (again as available in the Translator).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
If a Vite resource file is not found a
ViteException
exception is thrown. This makes sense since you need all resources available to make you application work.However there is one exception (I know of), if you have resources linked to a language.
If languages are switched and a translation is not found the framework will return the string in the default language. If the file name of a resource contains the language and it is not found it would make sense to be able to return something default.
Since there is no requirement to order your resources using a language the same fallback method as available in
Translator
would help to resolve this issue.My idea is to set a missing manifest files handler in one of the applications providers using a single call:
Vite::handleMissingManifestFilesUsing([$this, 'getMissingManifestFile'])
The handler itself could check if check if the resource is related to the language and return the image of the default language:
The handler itself will check if the file can be found in the manifest, if not the
ViteException
Exception will be thrown. Also if no handler is registered theViteException
is thrown.Also a function to check if a file exists in the manifest file can be helpful if the strings of the resources would be generated by a function (again as available in the Translator).
Beta Was this translation helpful? Give feedback.
All reactions