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 the dynamic module import fails, for example due to problems with the Internet connection, it will be cached and will never be able to import again.
Example
constbutton=document.getElementById('btn');button.onclick=async()=>{try{constmodule=awaitimport(`./module.js`);console.log(module.calc(1,2));}catch(err){console.log(err?.message);// <-- after fail we will always catch error}}
In native ESM we can add search like "?c=1" params to the end of the string:
import('./module.js?c=1')
and it will solve the problem
I didn't find a solution in the Vite documentation.
Suggested solution
Add support for dynamic search: const module = await import(`./dir/${file}.js?c=${count}`)
Alternative
Do not cache unsuccessfully loaded modules (Can be optional).
Add a special comment similar to /* @vite-ignore */ (for example /* @vite-nocache */)
Add some method for clearing cache vite import.meta.clearImportCache('./module.js')
Description
If the dynamic module import fails, for example due to problems with the Internet connection, it will be cached and will never be able to import again.
Example
In native ESM we can add search like "?c=1" params to the end of the string:
and it will solve the problem
I didn't find a solution in the Vite documentation.
Suggested solution
Add support for dynamic search:
const module = await import(`./dir/${file}.js?c=${count}`)
Alternative
/* @vite-ignore */
(for example/* @vite-nocache */
)Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: