The need for multi-platform npm packages
In this blog post, I argue that it should be possible to have multiple implementations of the same npm package (same name, same version). The problem At the moment, when you write an npm package, you can specify on what platforms it works, via the package.json property engines . For example : { "engines" : { "node" : ">=0.10.3 <0.12" } } { "engines" : { "npm" : "~1.0.20" } } That means that you can only have a single implementation per package. However, there are use cases for multiple implementations of the same package: For Node.js you can already use many ES6 features. For browsers, you should stay 100% ES5. There are Node.js-specific polyfills of Browser APIs. For example, node-fetch polyfills the fetch API. The module bundler Rollup needs the ES6 module format to achieve its superior file size savings. But that format doesn’t work anywhere else, yet. An idea for a solution I see two possible solutions: Al...