Package authors should include the "type" field, even in packages whereĪll sources are CommonJS. Via STDIN, with the flag -input-type=commonjs. Strings passed in as an argument to -eval or -print, or piped to node Or when referenced by import statements, import() expressions, orĬontains a top-level field "type" with a value of "commonjs". Will treat the following as CommonJS when passed to node as the initial input, However, now that Node.js supports bothĬommonJS and ES modules, it is best to be explicit whenever possible. Where the nearest parent package.json file contains no top-level "type"įield, or string input without the flag -input-type. Node.js will treat as CommonJS all other forms of input, such as. Strings passed in as an argument to -eval, or piped to node via STDIN, js extension when the nearest parent package.json fileĬontains a top-level "type" field with a value of "module". Initial input, or when referenced by import statements or import()įiles with a. Node.js will treat the following as ES modules when passed to node as the This page provides guidance for package authors writing package.json filesĪlong with a reference for the package.json fields defined by Node.js. Until the next folder containing another package.json file, or a folder The packageĬonsists of the folder containing the package.json file and all subfolders js file extension via package.json "type" field.Ī package is a folder tree described by a package.json file. Introduce "exports" package.json field as a more powerful alternative to the classic "main" field.Īdd support for ES modules using. Unflag self-referencing a package using its name. In 12.16.0, conditional exports are still behind -experimental-modules. Remove the -experimental-conditional-exports option.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |