Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested static module replacements don't work #16

Open
smrq opened this issue Aug 6, 2015 · 0 comments
Open

Nested static module replacements don't work #16

smrq opened this issue Aug 6, 2015 · 0 comments
Labels

Comments

@smrq
Copy link

smrq commented Aug 6, 2015

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants