Skip to content

ESM resolve does not ignore calls before quibbledModules are set #116

@markusvoelk-zr

Description

@markusvoelk-zr

I think the intention of the following code snipped is to ignore resolve calls until the first module gets "quibbled":

(https://github.com/testdouble/quibble/blob/fac450e65d68a00411a7ed51fc29f19af581f95b/lib/quibble.mjs#L42C1-L44C4)

if (!quibbleLoaderState.quibbledModules) {
    return resolve()
  }

Because the quibbleLoaderState.quibbledModules is a (at least) empty Map, the (!quibbleLoaderState.quibbledModules) expression never gets true.

I got memory issues because every imported module will be cached (and quibbled).
Changing the if-clause to if (!quibbleLoaderState.quibbledModules.size) { solves the issue for me.

Is there an other reason, the .size is missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions