fix(dev-server): normalize hot reload module paths
This commit is contained in:
@@ -259,6 +259,7 @@ async function rewriteArtifactImportsAsync(
|
||||
}
|
||||
|
||||
export async function loadModule(file: string): Promise<Record<string, unknown>> {
|
||||
file = resolve(file);
|
||||
let mod = moduleCache.get(file);
|
||||
if (!mod) {
|
||||
mod = (async () => {
|
||||
@@ -631,6 +632,7 @@ export function serveWrnBrowserArtifact(pathname: string): Response | null {
|
||||
|
||||
/** Forget one module and force its next dynamic import to bypass Bun's import cache. */
|
||||
export function invalidateModule(file: string): void {
|
||||
file = resolve(file);
|
||||
moduleCache.delete(file);
|
||||
moduleVersions.set(file, (moduleVersions.get(file) ?? 0) + 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user