Module system that works on Node.js and on the browser?

You are programming a lib X that depends on lib Y. You want that library to work on node.js and on the browser. On node.js, you'd use require('Y'). On the browser, you could use require.js. What's the proper way to implement it so your lib is cross-platform?

This one seems to be popular…

https://github.com/substack/node-browserify

you can try https://github.com/component/component. it's similar to browserify