felixge / node-sandboxed-module

A sandboxed node.js module loader that lets you inject dependencies into your modules.
MIT License
342 stars 42 forks source link

Circular requires that work with regular requires do not work with sandboxed-module #50

Open thoughtless opened 9 years ago

thoughtless commented 9 years ago

Node.js supports circular requires The behavior can be odd or unexpected, but it is supported.

In some cases though, this library is loading these circular requires differently, causing them to fail.

I posted an example of such a situation here: https://github.com/thoughtless/circular_require_demo

Another example is the NPM module aws-sdk. It has a circular require between service.js and core.js. require("sandboxed-module").require("aws-sdk") will fail.