Permalink
Browse files

Update README

  • Loading branch information...
1 parent ceaec08 commit fe5a9717baa381b9ef75936a03d3fcca1c1dbe64 @creationix committed Feb 21, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 README.markdown
View
@@ -10,9 +10,12 @@ The best way to explain this is to show a sample usage. Suppose that I have a n
var runInNewContext = require('vm').runInNewContext;
embedder({
+ // Embed my direct dependency
+ "protocol": require.resolve("protocol"),
+ // And also it's dependency
+ "msgpack-js": require.resolve("msgpack-js"),
+ // And my main script
"client": "./node_modules/client.js",
- "protocol": "./node_modules/protocol.js",
- "msgpack-js": "./node_modules/msgpack-js/msgpack.js",
}, function (err, code) {
if (err) throw err;
code += "\nrequire('client');\n";
@@ -23,3 +26,5 @@ The best way to explain this is to show a sample usage. Suppose that I have a n
console: console
}, "generated.js");
});
+
+Note that I included my main script as a dependency and then bootstrapped it with a manual require line. This isn't strictly required, but I find it cleaner.

0 comments on commit fe5a971

Please sign in to comment.