Last active
April 20, 2021 19:49
-
-
Save dominique-mueller/c25be90847a90a2df6aa7aad8c663b46 to your computer and use it in GitHub Desktop.
package.json fields for exports
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Support for native ESM (official) | |
// See <https://nodejs.org/api/packages.html#packages_type> | |
"type": "module", | |
// Export map (official) | |
// See <https://nodejs.org/api/packages.html#packages_subpath_exports> | |
"exports": { | |
".": { | |
"require": "./index.cjs", // Good old CJS | |
"import": "./index.js" // Brand new ESM | |
} | |
}, | |
// Export (unofficial) | |
// See <https://github.com/rollup/rollup/wiki/pkg.module> | |
"module": "./index.js", // Brand new ESM | |
// Export (unofficial?) | |
"main": "./index.cjs", // Good old CJS | |
// TypeScript typings (official) | |
// See <https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#including-declarations-in-your-npm-package> | |
"types": "index.d.ts", | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment