Consider the following example:
const vm = require('vm');
const Rx = require('rxjs');
const sandbox = { Rx, setTimeout, console };
const code = `
  observable = Rx.Observable.create(observer => {
    setTimeout(() => {
      console.log("Emitting 1");
      observer.next(1);
    }, 1000);
  });
`;
vm.runInNewContext(code, sandbox);
console.log('Subscribing');
sandbox.observable.subscribe(x => console.log(`Received ${x}`));
When I run this example in Node (v6.3.0), I get the following output as expected:
Subscribing
Emitting 1
Received 1
However, when this code runs through Webpack, I get only:
Subscribing
See here.
Any ideas what's going on here, and how to get the expected behavior when using Webpack?
via Misha Moroshko
No comments:
Post a Comment