File size: 449 Bytes
eb3f11e
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
/** Import a module by URL relative to another module, preserving query-string cache busting. */
export async function importFreshModule<TModule>(
  from: string,
  specifier: string,
): Promise<TModule> {
  // Vitest keys module instances by the full URL string, including the query
  // suffix. These tests rely on that behavior to emulate code-split chunks.
  return (await import(/* @vite-ignore */ new URL(specifier, from).href)) as TModule;
}