Skip to content

Invalidate imported module cache #5548

Closed
@keroxp

Description

@keroxp

I'm writing code using dynamic module import for dynamically generated code (tool like node-dev). In Deno, once module imported dynamically, they will be never updated while process running. Are there some way to invalidate module cache? In node.js, required module can be deleted.

Deno.writeTextFileSync("./target.ts", "export const value = 1;");
const v1 = await import("./target.ts")
console.log(v1.value); // 1
Deno.writeTextFileSync("./target.ts", "export const values = 2");
const v2 = await import("./target.ts")
console.log(v2.value); // should be 2 but got 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    clirelated to cli/ dirfeatnew feature (which has been agreed to/accepted)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions