Skip to content

MODULARIZE=1 causes repeated call to fail #5568

@nazar-pc

Description

@nazar-pc

I've found an interesting behavior when using MODULARIZE=1.
Let's assume lib.js is our Emscripten build with MODULARIZE=1, then:

instance_1 = require('./lib')(); // Everything is good so far
instance_2 = require('./lib')(); //TypeError: require(...) is not a function

The things is that during initial call module.exports is overridden with plain Module without function wrapper.

I've stumbled upon this when writing tests for one project: initially library was called by wrapper code and then I needed to call few internal functions for testing purposes and called require() on module directly.

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