Skip to content

Nested static module replacements don't work #16

Description

@smrq

I think an example is the easiest way to explain this.

var staticModule = require('static-module');

var rs = require('stream').Readable();
rs.push("var foo = require('foo');\n");
rs.push("window.x = foo(1, foo(2, 3, 4), foo(5, 6, 7));\n");
rs.push(null);

var sm = staticModule({
    foo: function (x, y, z) {
        return 'bar(' + x + ', ' + y + ', ' + z + ')'
    }
});

rs.pipe(sm).pipe(process.stdout);

// expected: bar(1, bar(2, 3, 4), bar(5, 6, 7));
// actual:   bar(1, bar(2, 3, 4), bar(5, 6, 7))bar(2, 3, 4)bar(5, 6, 7);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions