I’d love to have something like this:
"engines": {
"node >= 0.10.3, node < 0.12": {
"main": "./es5/index.js",
"bin": { "foo": "./es5/bin/foo.js" }
},
"ecmascript >= 2015": {
"main": "./es2015/index.js",
"bin": { "foo": "./es2015/bin/foo.js" }
}
},
An additional entry (similar to "main") could be "files", which would work like "browser".
Use cases:
- Node.js: deliver the same module for several versions of Node.js.
- Browsers: deliver both a native (e.g. ES5) version and another “bleeding edge” version, to be transpiled via Babel.
- Browsers: allow new libraries to age gracefully – transpile only as long your target platforms don’t support the features, yet.
- All platforms: deliver both a CommonJS and an ES module version.
I’d love to have something like this:
An additional entry (similar to
"main") could be"files", which would work like"browser".Use cases: