editions
field of your package.json
, with each edition being composed of the following fields:description
field to describe the editiondirectory
field for where the edition is locatedentry
field for the default file inside the directory
to be loadedrequire('some-package')
syntax, with a compiled edition for the default browsers, as well as a compiled edition for older node versions, then a compatible editions definition for it would look like so:main
property of the package.json
file:npm install --save editions
index.js
file that uses the Editions Autoloader to load the best edition from our available compatible editions.package.json
property main
to point to the index.js
file above, instead of a specfic edition.requirePackage
function.bin.js
custom entry, then we would perform the following.bin.js
file that uses the Editions Autoloader to load the best bin.js
script from our available compatible editions.bin
property in our package.json
file to point to the root bin.js
file we just created.test.js
custom entry, then we would perform the following.test.js
file that uses the Editions Autoloader to load the best test.js
script from our available compatible editions.scripts.test
property in our package.json
file to point to the root test.js
file we just created.browser
field in our package.json
like so:browser
field tells most tools like Browserify, WebPack, and Rollup to specifically use the edition that we precompiled for the browsers we target for.browser
field and its equivalents here:README.md
file via the HTML comment <!-- INSTALL -->
.<!-- INSTALL -->
comment in our README.md
file into the following rendered output:
require('project')
aliasesrequire('project/edition-node-0.8')
require('project/edition-node-0.8')
is ESNext compiled for Node.js >=0.8 with require for modules​
<!-- INSTALL -->
comment in our README.md
file into the following rendered output:
require('project')
aliasesrequire('project/index.js')
which uses the Editions Autoloader to automatically select the correct edition for the consumers environmentrequire('project/edition-node-0.8')
is ESNext compiled for Node.js >=0.8 with require for modules​