main
module
(previously jsnext:main
)import
browser
require
main
field is the standard target for package.json
files and is flagshipped by Node.module
field (formally the jsnext:main
field) is flagshipped by rollup.import
syntax rather than the require
syntax). The benefit to bundlers is that the explicit and static exporting and importing within ES Modules allows bundlers to build smaller and faster bundles that have more used code and less unused code in them. The bundle can then be compiled down to the lowest possible common demonator of features that the web browsers of the consumers audience supports.import
syntax for use in environments that only support ratified ES features, to which degree is unknown. Adding staging or alternative features (e.g. JSX) to this target increases complexity for the consumers of your package, as their environments, tooling or configurations may not support non-ratified features.import
syntax and only uses ratified ES features. Compiler presets such as babel-preset-latest will do the job. We do not currently recommend publishing an edition for this field if your source code did not originally use the ES Module syntax.browser
field is flagshipped by browserify.require
and module.exports
syntax) to combine all the files across different modules into a single bundle file, for use in the web browser.module
field has been introduced, as seen earlier.require
syntax. Compiling ES2015 and newer features down to ES5 is difficult as operational parity may not exist, causing such conversions to be error prone. Compiling other features or other languages may not have this issue. Consumer polyfills to emulate any missing ES2015 features are also an option. As such: