2

您正在编写一个依赖于 lib Y 的 lib X。您希望该库在 node.js 和浏览器上工作。在 node.js 上,您将使用require('Y'). 在浏览器上,您可以使用 require.js。实现它的正确方法是什么,以便您的库是跨平台的?

4

2 回答 2

4

这个好像很流行……</p>

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

于 2013-04-16T23:20:15.877 回答
2

你可以试试https://github.com/component/component。类似于browserify

于 2013-04-17T01:42:06.363 回答